package com.lesingle.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 错误码枚举
 * HTTP 状态码级别 + 业务错误码分组
 * 10xx 用户模块 / 20xx 活动模块 / 30xx 评审模块 / 40xx 作品模块 / 50xx 系统模块
 */
@Getter
@AllArgsConstructor
public enum ErrorCode {

    // ====== HTTP 状态码级别 ======
    SUCCESS(200, "success"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未登录或 Token 已过期"),
    FORBIDDEN(403, "没有访问权限"),
    NOT_FOUND(404, "资源不存在"),
    CONFLICT(409, "数据冲突"),
    INTERNAL_ERROR(500, "系统内部错误"),

    // ====== 用户模块 10xx ======
    USER_NOT_FOUND(1001, "用户不存在"),
    USER_DISABLED(1002, "用户已被禁用"),
    USER_PASSWORD_ERROR(1003, "密码错误"),
    USER_DUPLICATE(1004, "用户名已存在"),
    USER_PHONE_DUPLICATE(1005, "手机号已注册"),

    // ====== 短信验证码 10xx（接续用户模块） ======
    SMS_SEND_TOO_FREQUENT(1006, "发送验证码太频繁，请稍后再试"),
    SMS_DAILY_LIMIT_EXCEEDED(1007, "今日验证码发送次数已达上限"),
    SMS_CODE_EXPIRED(1008, "验证码已过期，请重新获取"),
    SMS_CODE_INVALID(1009, "验证码错误"),
    SMS_SEND_FAILED(1010, "验证码发送失败，请稍后再试"),

    // ====== 活动模块 20xx ======
    CONTEST_NOT_FOUND(2001, "活动不存在"),
    CONTEST_ALREADY_PUBLISHED(2002, "活动已发布"),
    CONTEST_NOT_PUBLISHED(2003, "活动未发布"),
    CONTEST_TIME_INVALID(2004, "活动时间配置无效"),
    CONTEST_REGISTRATION_CLOSED(2005, "报名已截止"),
    CONTEST_SUBMIT_CLOSED(2006, "提交已截止"),
    CONTEST_ALREADY_FINISHED(2007, "活动已结束"),
    CONTEST_REVIEW_INCOMPLETE(2008, "评审未完成"),

    // ====== 评审模块 30xx ======
    REVIEW_NOT_FOUND(3001, "评审记录不存在"),
    REVIEW_ALREADY_SCORED(3002, "已评分，请勿重复提交"),
    REVIEW_FINAL_SCORE_LOCKED(3003, "终分已锁定，无法修改评分"),
    REVIEW_NOT_ASSIGNED(3004, "作品未分配给该评委"),

    // ====== 作品模块 40xx ======
    WORK_NOT_FOUND(4001, "作品不存在"),
    WORK_ALREADY_SUBMITTED(4002, "作品已提交"),
    WORK_RESUBMIT_NOT_ALLOWED(4003, "不允许重新提交"),

    // ====== 文件上传模块 50xx ======
    FILE_TYPE_NOT_ALLOWED(5001, "不支持的文件类型"),
    FILE_SIZE_EXCEEDED(5002, "文件大小超限");

    private final Integer code;
    private final String message;
}
