package com.fjhx.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 入库类型
 */
@Getter
public enum InTypeEnum {

    WAREHOUSING(10, "入库"),
    INVENTORY_SURPLUS(11, "盘盈"),
    CORRECT(12, "数量添加修正"),
    SUPPLEMENT(13, "补入库"),
    TAG_DAMAGE(14, "标签损坏入库"),
    BACK(15, "归还入库"),
    RETURN_WAREHOUSE(16, "现场回仓"),
    WAREHOUSE_ADJUSTMENT(17, "调仓入库");

    private final Integer type;
    private final String name;

    private static final HashMap<Integer, InTypeEnum> map = new HashMap<>();
    private static final List<Integer> list = new ArrayList<>();

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

    static {
        for (InTypeEnum value : InTypeEnum.values()) {
            map.put(value.getType(), value);
            list.add(value.getType());
        }
    }

    /**
     * 根据type获取枚举
     */
    public static InTypeEnum get(Integer type) {
        return map.get(type);
    }

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

    public static List<Integer> list() {
        return list;
    }


}
