package com.unis.detectionnum.server.aenum;

/**
 * 告警级别
 */
public enum AlarmRuleTypeEnum {
	//0:资源;1:对象;2:告警字典
    RES(0, "资源"), OBJ(1, "对象"), ALARM(2, "告警字典");
    private int id;
    private String name;

    private AlarmRuleTypeEnum(final int id, final String name) {
        this.id = id;
        this.name = name;
    }

    /**
     * @return the id
     */
    public final int getId() {
        return this.id;
    }

    /**
     * @return the name
     */
    public final String getName() {
        return this.name;
    }

    /**
     * 根据alarmRuleType id 查找AlarmRuleTypeEnum.
     * @param id AlarmRuleTypeEnum.id
     * @return AlarmRuleTypeEnum
     */
    public static AlarmRuleTypeEnum parse(final int id) {
        for (final AlarmRuleTypeEnum alarmRuleType : AlarmRuleTypeEnum.values()) {
            if (id == alarmRuleType.getId()) {
                return alarmRuleType;
            }
        }
        return null;
    }

}
