# -*- coding: utf-8 -*-
"""
error_codes.py — 统一错误码定义

每个错误码为 (code, default_message) 元组，便于统一响应封装。
分类：
  - 1xxx 通用错误
  - 2xxx 搜索相关
  - 3xxx 缓存相关
  - 4xxx AI 相关
"""


class ErrorCodes:
    """统一错误码常量"""

    # 通用错误 1xxx
    UNKNOWN_ERROR = (1000, "未知错误")
    INVALID_PARAM = (1001, "参数错误")
    PERMISSION_DENIED = (1002, "权限不足")
    NOT_FOUND = (1003, "资源不存在")

    # 搜索相关 2xxx
    SEARCH_INDEX_ERROR = (2000, "搜索索引加载失败")
    SEARCH_QUERY_ERROR = (2001, "搜索查询失败")

    # 缓存相关 3xxx
    CACHE_READ_ERROR = (3000, "缓存读取失败")
    CACHE_WRITE_ERROR = (3001, "缓存写入失败")

    # AI 相关 4xxx
    AI_API_ERROR = (4000, "AI API 调用失败")
    AI_RESPONSE_ERROR = (4001, "AI 响应解析失败")
    AI_TIMEOUT = (4002, "AI 调用超时")
