package com.prolog.rdc.tms.model.enums;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * 预警消息类型枚举
 * @author hongbo.pan
 * @date 2022/11/16
 */
@AllArgsConstructor
@Getter
public enum MessageAlarmTypeEnum {

    PICK_UP("100", "未及时提货"),
    DELIVERY("101", "未及时送达"),
    RECEIPT("102", "未及时纸质回单"),
    TEMPERATURE("103", "温度预警"),

    ;
    public static final String MESSAGE_ALARM_TYPE = "MESSAGE_ALARM_TYPE";
    private static Map<String, MessageAlarmTypeEnum> enumMap = Maps.newHashMap();
    private String code;
    private String desc;

    static {
        for(MessageAlarmTypeEnum as : MessageAlarmTypeEnum.values()) {
            enumMap.put(as.code, as);
        }
    }

    public static MessageAlarmTypeEnum getByCode(String code) {
        return  enumMap.get(code);
    }

}
