package com.inspect.guideline.constant;

import lombok.Getter;

@Getter
public enum DefectTypeEnum {
    REGULAR("0", "正常"),
    COMMON("1", "一般缺陷"),
    SERIOUS("2", "严重缺陷"),
    URGENT("3", "紧急缺陷");

    private String type;
    private String name;

    private DefectTypeEnum() {
    }

    private DefectTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public static DefectTypeEnum getInstance(String type) {
        DefectTypeEnum[] defectTypeEnums = values();
        for (DefectTypeEnum value : defectTypeEnums) {
            if (value.getType().equals(type)) {
                return value;
            }
        }

        return null;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setName(String name) {
        this.name = name;
    }
}
