package com.fjhx.enums;

import lombok.Getter;

import java.util.HashMap;

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

    VISUAL_INSPECTION_QUALIFIED(0, "目测合格"),
    QUALIFIED(1, "合格"),
    UNQUALIFIED(2, "不合格");

    private final Integer type;
    private final String name;

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

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

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

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

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


}
