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","没有查询到未分析事件")
    ;

    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 "";
    }

}
