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

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

import java.util.Map;

/**
 * 归属枚举
 * @author hongbo.pan
 * @date 2022/10/8
 */
@AllArgsConstructor
@Getter
public enum BelongToEnum {

    OWN("1", "自有"),

    ANCHORED("2", "挂靠"),

    TEMPORARY("3", "临时"),
    ;

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

    static {
        for(BelongToEnum as : BelongToEnum.values()) {
            enumMap.put(as.code, as);
            enumDescMap.put(as.desc, as);
        }
    }

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

    public static BelongToEnum getByDesc(String desc) {
        return  enumDescMap.get(desc);
    }

}
