package com.fjhx.enums;

import lombok.Getter;

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

/**
 * 出库类型
 */
@Getter
public enum OutTypeEnum {

    ISSUE(20, "出库"),
    INVENTORY_LOSS(21, "盘亏"),
    CORRECT(22, "数量减少修正"),
    REPLENISHMENT(23, "补出库"),
    BINDING_ERROR(24, "绑定错误"),
    TAG_DAMAGE(25, "标签损坏出库"),
    RETURN_ISSUE(26, "退货出库"),
    SCRAP_ISSUE(27, "报废出库"),
    WAREHOUSE_ADJUSTMENT(28, "调仓出库");

    private final Integer type;
    private final String name;

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

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

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

    /**
     * 根据type获取枚举
     */
    public static OutTypeEnum 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;
    }


}
