package com.diagbot.enums.data;

import lombok.Setter;

public enum AutopsyEnum implements AKeyedNamed {

    YES("1", "是"),
    NO("2", "否");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

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

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