package com.diagbot.enums.data;

import lombok.Setter;

public enum SingleDiagManageEnum implements AKeyedNamed {
    YES("1", "有"),
    NO("2", "无");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

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

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