package com.hwrj.cloud.admin.dao.excel.enumbo;

public enum ConfirmStatus {
    NOT_CONFIRMED(0, "未确认"),
    CONFIRMED(1, "已确认"),
    DEFAULT(99, "未知");

    private Integer key;

    private String name;

    /**
     * @param key
     * @param name
     */
    ConfirmStatus(Integer key, String name) {
        this.key = key;
        this.name = name;
    }

    /**
     * @return Returns the key.
     */
    public Integer getKey() {
        return key;
    }

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


    /**
     * 根据Key得到枚举的Value
     * 普通for循环遍历，比较判断
     *
     * @param key
     * @return
     */
    public static ConfirmStatus getEnumType(Integer key) {
        ConfirmStatus[] alarmGrades = ConfirmStatus.values();
        for (int i = 0; i < alarmGrades.length; i++) {
            if (alarmGrades[i].getKey().equals(key)) {
                return alarmGrades[i];
            }
        }
        return ConfirmStatus.DEFAULT;
    }
}
