package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

/**
 * 采购进度
 */
@Getter
public enum PurchaseProgressEnum {

    CODING(0, "供应商打码"),
    SHIPMENT(1, "供应商出货"),
    LABELING(2, "到货贴标"),
    WAREHOUSING(3, "到货入库");

    private final Integer type;
    private final String name;

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

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

    static {
        for (PurchaseProgressEnum value : PurchaseProgressEnum.values()) {
            map.put(value.getType(), value);
        }
    }

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

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


}
