package com.shining.cloud.enums.information;

import com.njcn.enums.app.UserCodeEnum;

/**
 * @description:指标编码
 * @author gbl
 *
 */
public enum TypeCodeEnum{
	FLICKET_ALLTIME(1, "Flicket_AllTime"),
	FREQ_DEV_OVERTIME(2, "频率偏差越限"),
	VOLTAGE_DEV_OVERTIME(3, "电压偏差越限"),
	UBALANCE_OVERTIME(4, "电压不平衡越限"),
	FLICKER_OVERTIME(5, "闪变越限"),
	UABERRANCE_OVERTIME(6, "电压谐波畸变率越限"),
	UHARM_2_OVERTIME(7, "2次电压谐波含有率越限"),
	UHARM_3_OVERTIME(8, "3次电压谐波含有率越限"),
	UHARM_4_OVERTIME(9, "4次电压谐波含有率越限"),
	UHARM_5_OVERTIME(10, "5次电压谐波含有率越限"),
	UHARM_6_OVERTIME(11, "6次电压谐波含有率越限"),
	UHARM_7_OVERTIME(12, "7次电压谐波含有率越限"),
	UHARM_8_OVERTIME(13, "8次电压谐波含有率越限"),
	UHARM_9_OVERTIME(14, "9次电压谐波含有率越限"),
	UHARM_10_OVERTIME(15, "10次电压谐波含有率越限"),
	UHARM_11_OVERTIME(16, "11次电压谐波含有率越限"),
	UHARM_12_OVERTIME(17, "12次电压谐波含有率越限"),
	UHARM_13_OVERTIME(18, "13次电压谐波含有率越限"),
	UHARM_14_OVERTIME(19, "14次电压谐波含有率越限"),
	UHARM_15_OVERTIME(20, "15次电压谐波含有率越限"),
	UHARM_16_OVERTIME(21, "16次电压谐波含有率越限"),
	UHARM_17_OVERTIME(22, "17次电压谐波含有率越限"),
	UHARM_18_OVERTIME(23, "18次电压谐波含有率越限"),
	UHARM_19_OVERTIME(24, "19次电压谐波含有率越限"),
	UHARM_20_OVERTIME(25, "20次电压谐波含有率越限"),
	UHARM_21_OVERTIME(26, "21次电压谐波含有率越限"),
	UHARM_22_OVERTIME(27, "22次电压谐波含有率越限"),
	UHARM_23_OVERTIME(28, "23次电压谐波含有率越限"),
	UHARM_24_OVERTIME(29, "24次电压谐波含有率越限"),
	UHARM_25_OVERTIME(30, "25次电压谐波含有率越限"),
	IHARM_2_OVERTIME(31, "2次电流谐波幅值越限"),
	IHARM_3_OVERTIME(32, "3次电流谐波幅值越限"),
	IHARM_4_OVERTIME(33, "4次电流谐波幅值越限"),
	IHARM_5_OVERTIME(34, "5次电流谐波幅值越限"),
	IHARM_6_OVERTIME(35, "6次电流谐波幅值越限"),
	IHARM_7_OVERTIME(36, "7次电流谐波幅值越限"),
	IHARM_8_OVERTIME(37, "8次电流谐波幅值越限"),
	IHARM_9_OVERTIME(38, "9次电流谐波幅值越限"),
	IHARM_10_OVERTIME(39, "10次电流谐波幅值越限"),
	IHARM_11_OVERTIME(40, "11次电流谐波幅值越限"),
	IHARM_12_OVERTIME(41, "12次电流谐波幅值越限"),
	IHARM_13_OVERTIME(42, "13次电流谐波幅值越限"),
	IHARM_14_OVERTIME(43, "14次电流谐波幅值越限"),
	IHARM_15_OVERTIME(44, "15次电流谐波幅值越限"),
	IHARM_16_OVERTIME(45, "16次电流谐波幅值越限"),
	IHARM_17_OVERTIME(46, "17次电流谐波幅值越限"),
	IHARM_18_OVERTIME(47, "18次电流谐波幅值越限"),
	IHARM_19_OVERTIME(48, "19次电流谐波幅值越限"),
	IHARM_20_OVERTIME(49, "20次电流谐波幅值越限"),
	IHARM_21_OVERTIME(50, "21次电流谐波幅值越限"),
	IHARM_22_OVERTIME(51, "22次电流谐波幅值越限"),
	IHARM_23_OVERTIME(52, "23次电流谐波幅值越限"),
	IHARM_24_OVERTIME(53, "24次电流谐波幅值越限"),
	IHARM_25_OVERTIME(54, "25次电流谐波幅值越限");

    private int code;

    private String type;
    
	TypeCodeEnum(int code,String type){
		this.code = code;
		this.type = type;
	}

	public int getCode() {
		return code;
	}

	public String getType() {
		return type;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public void setType(String type) {
		this.type = type;
	}
	
    public static String getMsgByCode(int code){
        for (TypeCodeEnum typeCodeEnum : TypeCodeEnum.values()) {
            if (typeCodeEnum.code==code) {
                return typeCodeEnum.type;
            }
        }
        return "";
    }

    public static int getCodeByMsg(String type){
        for (TypeCodeEnum typeCodeEnum : TypeCodeEnum.values()) {
            if (typeCodeEnum.type.equalsIgnoreCase(type)) {
                return typeCodeEnum.code;
            }
        }
        return 0;
    }
    
    @Override
    public String toString() {
        return "TypeCodeEnum{" +
                "code=" + code +
                ", type='" + type + '\'' +
                '}';
    }
}