package com.frontleaves.general.utils

import org.springframework.http.HttpStatus

enum class ErrorCode(val output: String, val code: Int, val message: String, val httpStatus: HttpStatus) {
    MISSING_PATH_VALUE(
        "MissingPathValue",
        40010,
        "URL参数缺失",
        HttpStatus.BAD_REQUEST
    ),
    MISSING_PARAMETER(
        "MissingParameter",
        40011,
        "Param参数缺失",
        HttpStatus.BAD_REQUEST
    ),
    MISSING_REQUEST_BODY(
        "MissingRequestBody",
        40012,
        "RequestBody参数缺失",
        HttpStatus.BAD_REQUEST
    ),
    USER_NOT_FOUNDED(
        "UserNotFounded",
        40014,
        "没有找到用户",
        HttpStatus.BAD_REQUEST
    ),
    CONFIG_ERROR(
        "ConfigError",
        40017,
        "配置错误",
        HttpStatus.BAD_REQUEST
    ),
    WHITELIST_IS_NOT_CONFIGURED(
        "WhitelistIsNotConfigured",
        40018, "未配置白名单",
        HttpStatus.BAD_REQUEST
    ),
    BLACKLIST_IS_NOT_CONFIGURED(
        "BlacklistIsNotConfigured",
        40019, "未配置黑名单",
        HttpStatus.BAD_REQUEST
    ),
    TYPE_OBJECT_MISMATCH(
        "TypeObjectMismatch",
        40020, "类型不匹配",
        HttpStatus.BAD_REQUEST
    ),
    QPS_LIMITATION_GLOBAL(
        "QPSLimitationGlobal",
        40023,
        "全局QPS限制，请过10分钟后操作",
        HttpStatus.BAD_REQUEST
    ),
    QPS_LIMITATION_VISIT(
        "QPSLimitationVisit",
        40024,
        "QPS限制，请过1分钟后操作",
        HttpStatus.BAD_REQUEST
    ),
    UNABLE_TO_GENERATE_VERIFY_KEY(
        "UnableToGenerateVerifyKey",
        40025,
        "无法生成验证密钥（VerifyKey）",
        HttpStatus.BAD_REQUEST
    ),
    YOU_ARE_ALREADY_LOGIN(
        "YouAreAlreadyLogin",
        40026,
        "您已经登录",
        HttpStatus.BAD_REQUEST
    ),
    REGISTRATION_NOT_ALLOWED(
        "RegistrationNotAllowed",
        40027,
        "不允许注册",
        HttpStatus.BAD_REQUEST
    ),
    YOU_ARE_NOT_LOGIN(
        "YouAreNotLogin",
        40110,
        "您未登录",
        HttpStatus.UNAUTHORIZED
    ),
    TYPE_MISMATCH(
        "TypeMismatch",
        40310,
        "参数 [action] 错误",
        HttpStatus.FORBIDDEN
    ),
    USER_EXIST(
        "UserExist",
        40311,
        "用户已存在不能创建",
        HttpStatus.FORBIDDEN
    ),
    USER_BANED(
        "UserBaned",
        40312,
        "用户已被封禁",
        HttpStatus.FORBIDDEN
    ),
    TOKEN_NOT_EXIST(
        "TokenNotExist",
        40313,
        "Cookie中Token不存在",
        HttpStatus.FORBIDDEN
    ),
    TOKEN_VERIFY_FAILED(
        "TokenVerifyFailed",
        40314,
        "Token校验失败",
        HttpStatus.FORBIDDEN
    ),
    TOKEN_NOT_FOUNDED(
        "TokenNotFounded",
        40315,
        "Token不存在",
        HttpStatus.FORBIDDEN
    ),
    WRONG_PASSWORD(
        "WrongPassword",
        40316,
        "密码不正确",
        HttpStatus.FORBIDDEN
    ),
    NOT_APIKEY(
        "NotApikey",
        40317,
        "apikey不正确",
        HttpStatus.FORBIDDEN
    ),
    TIMESTAMP_EXPIRED(
        "TimestampExpired",
        40318,
        "时间戳过期",
        HttpStatus.FORBIDDEN
    ),
    METHOD_NOT_ALLOWED(
        "MethodNotAllowed",
        40510,
        "请求方法不允许",
        HttpStatus.METHOD_NOT_ALLOWED
    ),
    DATABASE_UPDATE_OPERATION_FAILED(
        "DatabaseUpdateOperationFailed",
        50010,
        "覆写数据库内容操作失败",
        HttpStatus.INTERNAL_SERVER_ERROR
    ),
    DATABASE_INSERT_OPERATION_FAILED(
        "DatabaseInsertOperationFailed",
        50011,
        "插入数据库内容操作失败",
        HttpStatus.INTERNAL_SERVER_ERROR
    ),
    DATABASE_DELETE_OPERATION_FAILED(
        "DatabaseDeleteOperationFailed",
        50012,
        "删除数据库内容操作失败",
        HttpStatus.INTERNAL_SERVER_ERROR
    ),
    HTTP_MESSAGE_NOT_READABLE_EXCEPTION(
        "HttpMessageNotReadableException",
        50013,
        "Http消息不可读异常",
        HttpStatus.INTERNAL_SERVER_ERROR
    );

}
