package com.njcn.gather.system.pojo.enums;

import lombok.Getter;

/**
 * @author cdf
 * @version 1.0.0
 */
@Getter
public enum DicDataEnum {


    FREQ("FREQ","频率"),
    V("V","电压"),
    I("I","电流"),
    IMBV("IMBV","三相电压不平衡度"),
    IMBA("IMBA","三相电流不平衡度"),

    HV("HV","谐波电压"),
    HI("HI","谐波电流"),
    HP("HP","谐波有功功率"),
    HSV("HSV","间谐波电压"),
    HSI("HSI","间谐波电流"),
    VOLTAGE("VOLTAGE","暂态"),
    F("F","闪变"),



    ;


    private final String code;

    private final String message;

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

    public static DicDataEnum getEnumByCode(String code) {
        for (DicDataEnum e : DicDataEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static String getMessageByCode(String code) {
        DicDataEnum e = getEnumByCode(code);
        if (e!= null) {
            return e.getMessage();
        }
        return "";
    }
}
