package com.prolog.rdc.tms.constant.enums.intelligent;

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

import java.math.BigDecimal;
import java.util.Map;

/**
 * 智能调度配载率枚举
 * @author hongbo.pan
 * @date 2023/8/31
 */
@AllArgsConstructor
@Getter
public enum IntelligentDispatchRateEnum {

    NINETY_FIVE(1, BigDecimal.valueOf(95),"低于95%"),
    NINETY(2, BigDecimal.valueOf(90),"低于90%"),
    EIGHTY(3, BigDecimal.valueOf(80),"低于80%"),
    SEVENTY(4, BigDecimal.valueOf(70),"低于70%"),
    SIXTY(5, BigDecimal.valueOf(60),"低于60%"),
    FIFTY(6, BigDecimal.valueOf(50),"低于50%"),
    ;

    private static Map<Integer, IntelligentDispatchRateEnum> enumMap = Maps.newHashMap();
    private Integer code;
    private BigDecimal rate;
    private String desc;

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

    public static IntelligentDispatchRateEnum getByCode(Integer code) {
        return  enumMap.get(code);
    }

}
