package org.wcs.constant.enums.database;

import lombok.Getter;

/**
 * 报警类型枚举
 */
@Getter
public enum BaseErrorTypeEnum {

    NET_ERROR(0, "网络异常"),
    POWER_ERROR(3, "电源异常"),
    EQUIPMENT_ERROR(2, "设备异常");

    private final Integer code;
    private final String name;

    BaseErrorTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(Integer code) {
        for (BaseErrorTypeEnum value : BaseErrorTypeEnum.values()) {
            if (value.code.equals(code)) {
                return value.name;
            }
        }
        return null;
    }

}
