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

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

import java.util.Map;

/**
 * 合同模式枚举
 * @author hongbo.pan
 * @date 2023/4/11
 */
@AllArgsConstructor
@Getter
public enum ContractModeEnum {

    SHIPPER(1, "托运"),
    CARRIER(2, "承运"),
    DRIVER(3, "司机"),
    ;

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

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

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

}
