package com.diagbot.enums.data;

import lombok.Setter;

public enum DiagnoseTypeEnum implements AKeyedNamed{
    NO_DONE("0", "未做"),
    ACCORD("1", "符合"),
    NO_ACCORD("2", "不符合"),
    UN_CHECK("3", "不确定");

    @Setter
    private String key;

    @Setter
    private String name;

    DiagnoseTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public static DiagnoseTypeEnum getEnum(String key) {
        for (DiagnoseTypeEnum item : DiagnoseTypeEnum.values()) {
            if (key.equals(item.getKey())) {
                return item;
            }
        }
        return null;
    }

    public static String getName(String key) {
        DiagnoseTypeEnum item = getEnum(key);
        return item != null ? item.name : null;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getName() {
        return name;
    }
}
