package com.njcn.prepare.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 指标参数类型枚举
 */
@Getter
public enum SteadyIndicatorEnum {

    Negative_Voltage("Negative_Voltage", "负序电压不平衡度超标"),
    Interhar_Voltage("Interhar_Voltage", "间谐波电压超标"),
    Neg_Current("Neg_Current", "负序电流超标"),
    Fre_Deviation("Fre_Deviation", "频率偏差超标"),
    Voltage_Dev("Voltage_Dev", "电压偏差超标"),
    Har_Current("Har_Current", "谐波电流超标"),
    Voltage_Fluc("Voltage_Fluc", "电压波动与闪变超标"),
    Har_Voltage("Har_Voltage", "谐波电压超标");

    private final String code;

    private final String message;

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

    public static SteadyIndicatorEnum getSteadyIndicatorEnumByCode(String code) {
        for (SteadyIndicatorEnum steadyIndicatorEnum : SteadyIndicatorEnum.values()) {
            if (StringUtils.equals(code, steadyIndicatorEnum.getCode())) {
                return steadyIndicatorEnum;
            }
        }
        return null;
    }
}
