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

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

import java.util.Map;

/**
 * 智能调度最优规则枚举
 * @author hongbo.pan
 * @date 2023/8/23
 */
@AllArgsConstructor
@Getter
public enum IntelligentRuleEnum {

    SHORTEST_MILEAGE("1", "运输里程最短"),
    LOWEST_COST("2", "运输成本最低"),
    MIN_VEHICLE_NUM("3", "承运车辆最少"),
    COST_OPTIMAL("4", "综合成本最优"),
    ;

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

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

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

}
