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 MessageTimeUnitEnum {

    SECOND("1", "秒"),
    MINUTE("2", "分钟"),
    HOUR("3", "小时"),
    DAY("4", "天"),
    ;
    public static final String MESSAGE_ORDER_TYPE = "MESSAGE_ORDER_TYPE";
    private static Map<String, MessageTimeUnitEnum> enumMap = Maps.newHashMap();
    private String code;
    private String desc;

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

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

}
