package com.template.common.result;

/**
 * 响应结果枚举，用于提供给GraceJSONResult返回给前端的
 * 本枚举类中包含了很多的不同的状态码供使用，可以自定义
 * 便于更优雅的对状态码进行管理，一目了然
 */
public enum ResponseStatusEnum implements Code{


    SUCCESS(200, true, "操作成功！"),
    NO_PERMISSION(401,false,"没有权限"),
    MISSING_REQUEST_HEADER(499,false,"缺少请求头"),
    FAILED(500, false, "操作失败！"),
    SEND_PARAMS(501,false,"传入参数数据结构错误"),
    SEND_PARAMS_TYPE(502,false,"传入参数数据类型错误"),
    UN_SERVICES_ERROR(505,false,"操作失败，请联系管理员"),

    // 自定义系统级别异常 54x
    SYSTEM_ERROR(540, false, "系统错误，错误未知！"),
    SYSTEM_INDEX_OUT_OF_BOUNDS(541, false, "系统错误，数组越界！"),
    SYSTEM_ARITHMETIC_BY_ZERO(542, false, "系统错误，无法除零！"),
    SYSTEM_NULL_POINTER(543, false, "系统错误，空指针！"),
    SYSTEM_NUMBER_FORMAT(544, false, "系统错误，数字转换异常！"),
    SYSTEM_PARSE(545, false, "系统错误，解析异常！"),
    SYSTEM_IO(546, false, "系统错误，IO输入输出异常！"),
    SYSTEM_FILE_NOT_FOUND(547, false, "系统错误，文件未找到！"),
    SYSTEM_CLASS_CAST(548, false, "系统错误，类型强制转换错误！"),
    SYSTEM_PARSER_ERROR(549, false, "系统错误，解析出错！"),
    SYSTEM_DATE_PARSER_ERROR(550, false, "系统错误，日期解析出错！"),
    SYSTEM_ERROR_GLOBAL(551, false, "系统繁忙，请稍后再试！"),
    SYSTEM_ERROR_ZUUL(552, false, "请求系统过于繁忙，请稍后再试！"),
    SYSTEM_REQUEST_METHOD_ERROR(553, false, "请求类型错误"),
    SYSTEM_MYSQL_TIMEOUT_ERROR(554, false, "Mysql连接超时"),
    SYSTEM_MONGO_TIMEOUT_ERROR(555, false, "Mongo连接超时"),
    SYSTEM_PHONE_ERROR(556,false,"手机号格式错误"),
    SYSTEM_SEND_PHONE_ERROR(557,false,"发送验证码失败"),
    SYSTEM_TOKEN_ERROR(558,false,"token为空"),
    SYSTEM_LOGIN_ERROR(559,false,"无效token"),
    PARAM_ERROR(560, false, "参数不能为空！"),
    GZH_ERROR(561, false, "设置失败，请先关联公众号！"),
    EXISTS(999,false,"已存在");

    // 响应业务状态
    private Integer status;
    // 调用是否成功
    private Boolean success;
    // 响应消息，可以为成功或者失败的消息
    private String msg;

    ResponseStatusEnum(Integer status, Boolean success, String msg) {
        this.status = status;
        this.success = success;
        this.msg = msg;
    }

    public Integer status() {
        return status;
    }
    public Boolean success() {
        return success;
    }
    public String msg() {
        return msg;
    }

    @Override
    public Integer getStatus() {
        return status;
    }

    @Override
    public Boolean getSuccess() {
        return success;
    }

    @Override
    public String getMsg() {
        return msg;
    }


}
