package com.fjhx.iot.enums;

import lombok.Getter;

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

@Getter
public enum UpperComputerEnum {

    ZSJ(1, "注塑机"),
    GYJ(2, "滚印机"),
    ZZJ(3, "组装机"),
    LWT(4, "螺纹头"),
    ZSZ(5, "注射针");

    /**
     * 设备类型
     */
    private final Integer type;
    /**
     * 类型名称
     */
    private final String typeName;

    UpperComputerEnum(Integer type, String typeName) {
        this.type = type;
        this.typeName = typeName;
    }

    private static final Map<Integer, UpperComputerEnum> CLASS_MAP = new HashMap<>();

    static {
        for (UpperComputerEnum value : UpperComputerEnum.values()) {
            CLASS_MAP.put(value.getType(), value);
        }
    }

    /**
     * 根据设备id获取枚举
     */
    public static UpperComputerEnum getUpperComputerEnum(Integer type) {
        return CLASS_MAP.get(type);
    }

}
