package com.lesingle.edu.common.enums;

import lombok.Getter;

/**
 * Error Code Enum
 */
@Getter
public enum ErrorCode {

    SUCCESS(200, "成功"),
    BAD_REQUEST(400, "请求失败"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "方法不允许"),
    INTERNAL_ERROR(500, "服务器内部错误"),

    // Business Errors (1000+)
    LOGIN_FAILED(1001, "登录失败"),
    ACCOUNT_NOT_FOUND(1002, "账号不存在"),
    ACCOUNT_DISABLED(1003, "账户已停用"),
    INCORRECT_PASSWORD(1004, "密码错误"),
    TOKEN_EXPIRED(1005, "Token 已过期"),
    TOKEN_INVALID(1006, "Token 无效"),
    PERMISSION_DENIED(1007, "权限不足"),

    // Data Errors (2000+)
    DATA_NOT_FOUND(2001, "数据不存在"),
    DATA_ALREADY_EXISTS(2002, "数据已存在"),
    DATA_IN_USE(2003, "数据使用中"),
    INVALID_PARAMETER(2004, "参数无效"),

    // Tenant Errors (3000+)
    TENANT_NOT_FOUND(3001, "租户不存在"),
    TENANT_EXPIRED(3002, "租户已过期"),
    TENANT_DISABLED(3003, "租户已停用"),
    TENANT_SUSPENDED(3004, "您的账户因租户服务暂停而无法登录，请联系学校管理员"),

    // Package Errors (3100+)
    PACKAGE_NOT_FOUND(3101, "套餐不存在"),
    REMOVE_PACKAGE_HAS_SCHEDULES(3102, "该套餐下有排课计划，无法删除"),

    // User Errors (4000+)
    USER_NOT_FOUND(4001, "用户不存在"),
    USER_ALREADY_EXISTS(4002, "用户已存在"),
    PASSWORD_MISMATCH(4003, "密码不匹配"),
    OLD_PASSWORD_ERROR(4004, "原密码错误");

    private final Integer code;
    private final String message;

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

}
