package com.qmth.jkserver.core.exception;

public class ApiException extends RuntimeException {

    private static final long serialVersionUID = -8007657202243426183L;

    public static final ApiException SYSTEM_EXCEPTION = new ApiException(-100, "系统错误");
    public static final ApiException TOKEN_INVALID = new ApiException(-101, "token错误");
    public static final ApiException TOKEN_NEEDED = new ApiException(-102, "无法从请求中获取token鉴权参数");
    public static final ApiException EXAM_CODE_INVALID = new ApiException(-103, "考试识别码为空或者错误");
    public static final ApiException EXAM_PLAN_DISABLED = new ApiException(-104, "考试任务不可用");
    public static final ApiException FILE_UPLOAD_ERROR = new ApiException(-105, "文件上传失败");
    public static final ApiException FILE_MD5_NOT_MATCH = new ApiException(-106, "文件MD5校验失败");
    public static final ApiException MISSING_PARAMS_MAC = new ApiException(-107, "缺少参数mac");
    public static final ApiException KW_STORE_DATA_ERROR = new ApiException(-108, "考务数据存储错误");
    public static final ApiException KW_STORE_KC_ERROR = new ApiException(-109, "考务存储数据中考场文件不存在");
    public static final ApiException PLACE_CODE_INVALID = new ApiException(-110, "考点代码不被识别");
    public static final ApiException ROOM_CODE_INVALID = new ApiException(-111, "考场代码不被识别");
    public static final ApiException EXAM_PLAN_UN_PUBLISHED = new ApiException(-112, "考试计划没有发布");
    public static final ApiException PARAM_MD5_MISSING = new ApiException(-113, "请求参数中没有md5参数 ");
    public static final ApiException NOT_FILE_UPLOAD_REQUEST = new ApiException(-114, "不是文件上传的请求");
    public static final ApiException SOLFEGE_RECORDS_IS_NULL = new ApiException(-115, "参数中缺少视唱录音文件records");
    public static final ApiException SOLFEGE_USER_INFO_IS_NULL = new ApiException(-116, "参数中缺考生信息userInfo");
    public static final ApiException SOLFEGE_PAPER_IS_NULL = new ApiException(-117, "参数中缺少试卷信息");
    public static final ApiException SOLFEGE_LOCAL_TIME_IS_NULL = new ApiException(-118, "参数中缺少LocalTime信息");
    public static final ApiException PLACE_CODE_IS_NULL = new ApiException(-119, "考点代码为空");
    public static final ApiException ROOM_CODE_IS_NULL = new ApiException(-120, "考场代码为空");
    public static final ApiException TIMESTAMP_IS_NULL = new ApiException(-121, "时间戳为空");
    public static final ApiException SIGN_INVALID = new ApiException(-122, "签名错误");
    public static final ApiException NOTICE_TYPE_INVALID = new ApiException(-123, "通知类型参数错误,type不能够为空，且取值只能够是0或者1");
    public static final ApiException BATCH_ID_INVALID = new ApiException(-124, "批次id不能够是空的");
    public static final ApiException PASSWORD_NOT_SET = new ApiException(-125, "尚未设置开卷密码");
    public static final ApiException PARAM_TICKET_NUMBER_IS_MISSING = new ApiException(-126, "请求参数中没有考生的准考证号 ");


    
    private int code;

    private String message;

    public ApiException(int code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public ApiException withMessage(String message) {
        return new ApiException(-100, message);
    }

}
