package com.friday.tooldriver.constants;

public class DriverSystemCode {

    public static final DriverSystemCode SUCCESS = valueOf(0,"成功");
    public static final DriverSystemCode FAIL = valueOf(1000,"失败");
    public static final DriverSystemCode INTERNAL_ERROR = valueOf(500,"系统内部错误");
    public static final DriverSystemCode HTTP_REQUEST_ERROR = valueOf(708,"HTTP请求失败");
    public static final DriverSystemCode UIPATH_RESPONSE_DATA_ERROR = valueOf(709,"UIPATH请求返参无效");
    public static final DriverSystemCode INFODATOR_RESPONSE_DATA_ERROR = valueOf(710,"INFODATOR请求返参无效");
    public static final DriverSystemCode INVALID_KEY_ERROR = valueOf(711,"无效的查询键值");

    public static final DriverSystemCode CODE_FILE_NOT_EXIST = valueOf(712, "代码包文件不存在");

    public static final DriverSystemCode CODE_FILE_DOWNLOAD_ERROR = valueOf(713, "代码包文件下载失败");

    public static final DriverSystemCode PACKAGE_DUPLICATE_ERROR = valueOf(2001, "上传失败, 与上一版本文件内容相同");

    public static final DriverSystemCode PACKAGE_UPLOAD_NOT_MATCH = valueOf(2002,"代码包上传失败，代码包名与流程名不匹配");




    protected static DriverSystemCode valueOf(int code, String message) {
        return new DriverSystemCode(code, message);
    }

    private int code;
    private String message;

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

    public int getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    @Override
    public String toString() {
        return "system code: " + this.code + ", " + this.message;
    }

    public String toString(String ... str){
        return "system code: " + this.code + ", " + this.message + ": " + String.join(", ", str);
    }
}
