package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

/**
 * 质检状态
 */
@Getter
public enum CheckStatusEnum {

    NO_QUALITY_INSPECTION(0, "未质检"),
    INSPECTED(1, "已质检"),
    NO_QUALITY_INSPECTION_REQUIRED(2, "无需质检");

    private final Integer type;
    private final String name;

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

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

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

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

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


}
