package com.njcn.advance.enums;

import lombok.Getter;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2021年04月13日 10:50
 */
@Getter
public enum AdvanceResponseEnum {

    ANALYSIS_USER_DATA_ERROR("A0101","解析用采数据内容失败"),

    INTERNAL_ERROR("A0101","系统内部异常"),

    USER_DATA_EMPTY("A0101","用采数据内容为空"),

    USER_DATA_NOT_FOUND("A0101","未找到用采数据"),

    RESP_DATA_NOT_FOUND("A0101","未找到责任划分数据"),

    WIN_TIME_ERROR("A0101","限值时间小于窗口"),

    CALCULATE_INTERVAL_ERROR("A0101","对齐计算间隔值非法"),

    RESP_RESULT_DATA_NOT_FOUND("A0101","未找到责任划分缓存数据"),

    USER_DATA_P_NODE_PARAMETER_ERROR("A0101","无用采用户或所有用户的完整性均不满足条件"),

    RESPONSIBILITY_PARAMETER_ERROR("A0101","调用接口程序计算失败，参数非法"),

    EVENT_EMPTY("A0102","没有查询到未分析事件"),

    USER_NAME_EXIST("A0103","用户名已存在"),

    DATA_NOT_FOUND("A0104","数据缺失，请根据模版上传近两周数据"),

    DATA_UNDERRUN("A0104","数据量不足，请根据模版上传充足近两周数据"),

    DOCUMENT_FORMAT_ERROR("A0105","数据缺失，导入失败！请检查导入文档的格式是否正确"),
    DEVICE_LOST("A0104","用户下缺少设备"),

    USER_LOST("A0106","干扰源用户缺失"),
    UNCOMPLETE_STRATEGY("A0106","配置安全，III级预警,II级预警,I级预警4条完整策略"),
    EXISTENCE_EVALUATION_RESULT("A0104","存在评结果结果，如要评估，请删除后评估"),

    SG_USER_NAME_REPEAT("A0102","业务用户名重复"),

    SG_PRODUCT_LINE_NAME_REPEAT("A0102","生产线名重复"),

    SG_USER_ID_MISS("A0102","业务用户id缺失"),

    SG_PRODUCT_LINE_ID_MISS("A0102","生产线id缺失"),

    SG_MACHINE_ID_MISS("A0102","设备id缺失"),

    IMPORT_EVENT_DATA_FAIL("A0102","请检查导入数据的准确性"),

    PRODUCT_LINE_DATA_MISS("A0102","生产线数据缺失"),

    MACHINE_DATA_MISS("A0102","设备数据缺失"),

    INCOMING_LINE_DATA_MISS("A0102","进线数据缺失"),

    EVENT_DATA_MISS("A0102","没有可供参考的暂降数据"),

    WIN_DATA_ERROR("A0102","算法校验窗宽超限"),

    DATA_ERROR("A0102","算法校验数据长度超限"),

    INIT_DATA_ERROR("A0102","算法初始化数据失败"),

    USER_HAS_PRODUCT("A0102","当前用户存在生产线"),

    PRODUCT_HAS_MACHINE("A0102","当前生产线存在设备"),

    MACHINE_HAS_UNIT("A0102","当前设备存在元器件"),

    EVENT_TIME_ERROR("A0102","暂降事件时间格式有误，请检查"),

    INVALID_FILE_TYPE("A0102","请选择CSV文件"),
    HARMONICCHARACTER_NAME_REPETITION("A0103","谐波源特性名称重复"),
    CABLETYPE_NAME_REPETITION("A0103","线路线缆名称重复"),
    TRANSFORMER_NAME_REPETITION("A0103","变压器类型名称重复"),
    SHOCKLOAD_NAME_REPETITION("A0103","冲击负荷类型名称重复"),
    ASSESSUSER_NAME_REPETITION("A0103","评估用户名称重复"),
    CAPACITOR_NAME_REPETITION("A0103","电容器组名称重复"),
    LOAD_NAME_REPETITION("A0103","用户负荷名称重复"),
    INPACTLOADTYPE_NAME_REPETITION("A0103","冲击负荷类型重复"),
    TRANS_NAME_REPETITION("A0103","变压器名称重复"),
    WIND_NAME_REPETITION("A0103","风机名称重复"),
    ;

    private final String code;

    private final String message;

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

    public static String getCodeByMsg(String msg){
        for (AdvanceResponseEnum userCodeEnum : AdvanceResponseEnum.values()) {
            if (userCodeEnum.message.equalsIgnoreCase(msg)) {
                return userCodeEnum.code;
            }
        }
        return "";
    }

}
