package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 仓库类型
 */
@Getter
public enum WarehouseTypeEnum {
    ORDINARY(1, "普通仓库"),
    FINISHED_PRODUCT(2, "成品仓库"),
    RAW_MATERIAL(3, "原料仓库"),
    AUXILIARY(4, "辅助料仓库"),
    ACCESSORIES(5, "配件仓库"),
    MANAGEMENT(6, "处置仓库");

    WarehouseTypeEnum(Integer type, String name) {
        this.type = type;
        this.name = name;
    }

    private final Integer type;
    private final String name;

    private static final Map<Integer, String> map = new HashMap<>();

    static {
        for (WarehouseTypeEnum value : WarehouseTypeEnum.values()) {
            map.put(value.type, value.name);
        }
    }

    /**
     * 根据type值获取name
     */
    public static String getName(Integer type) {
        return map.get(type);
    }

    /**
     * 获取键值对
     */
    public static Map<Integer, String> getMap() {
        return map;
    }


}
