package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

/**
 * 物料属性
 */
@Getter
public enum MaterialTypeEnum {

    JET_PRINT(0, "直喷"),
    TRANSFER(1, "热转"),
    TYPING(2, "打纸"),
    INK(3, "墨水"),
    OTHER(4, "其他");

    private final Integer type;
    private final String name;

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

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

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

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

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

}
