package com.gonghang.h5clientapp.common.enumData;

/**
 * 告警等级
 * Created by shiwn on 2021/6/23 15:24
 */
public enum AlarmLevelEnum {
    NORMAL(0, "正常"),
    TYPE_1(1, "预警"),
    TYPE_2(2, "一般告警"),
    TYPE_3(3, "严重告警"),
    TYPE_4(4, "危急告警");

    private int code;
    private String msg;

    AlarmLevelEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * @Description: 根据code取msg
     * @Date: 2021/6/24 15:18
     * @Author: shiwn
     * @Param: [code]
     * @Return:
     */
    public static String getMsg(int code) {
        for (AlarmLevelEnum c : AlarmLevelEnum.values()) {
            if (c.getCode() == code) {
                return c.msg;
            }
        }
        return null;
    }
}
