package com.yaoai.common.exception;

import lombok.Getter;

/**
 * 统一错误码枚举
 */
@Getter
public enum ErrorCode {

    // ===== 通用 =====
    SUCCESS("0", "success"),
    INVALID_PARAM("INVALID_PARAM", "无效参数"),
    NOT_FOUND("NOT_FOUND", "资源不存在"),
    UNAUTHORIZED("UNAUTHORIZED", "未登录或 Token 失效"),
    FORBIDDEN("FORBIDDEN", "无权限访问"),
    INTERNAL_ERROR("INTERNAL_ERROR", "服务器内部错误"),
    TOO_MANY_REQUESTS("TOO_MANY_REQUESTS", "请求过于频繁，请稍后重试"),

    // ===== 业务 =====
    PROJECT_NOT_FOUND("PROJECT_NOT_FOUND", "项目不存在"),
    INSUFFICIENT_BALANCE("INSUFFICIENT_BALANCE", "积分余额不足"),
    TASK_NOT_FOUND("TASK_NOT_FOUND", "任务不存在"),
    TASK_CANNOT_CANCEL("TASK_CANNOT_CANCEL", "任务无法取消"),
    TENANT_QUOTA_EXCEEDED("TENANT_QUOTA_EXCEEDED", "已超出租户配额"),
    STORYBOARD_NOT_FOUND("STORYBOARD_NOT_FOUND", "分镜不存在"),
    CHARACTER_NOT_FOUND("CHARACTER_NOT_FOUND", "角色不存在"),

    // ===== 文件 =====
    FILE_TOO_LARGE("FILE_TOO_LARGE", "文件大小超出限制"),
    FILE_TYPE_NOT_SUPPORTED("FILE_TYPE_NOT_SUPPORTED", "不支持的文件类型"),
    UPLOAD_FAILED("UPLOAD_FAILED", "文件上传失败");

    private final String code;
    private final String message;

    ErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }
}
