package com.diagbot.enums.data;

import lombok.Setter;

public enum DoctorAdviceTypeEnum implements AKeyedNamed {
    C_ADVICE("C", "出院带药"),
    R_ADVICE("R", "长期医嘱"),
    S_ADVICE("S", "临时医嘱"),
    E_ADVICE("E", "紧急临时医嘱");

    @Setter
    private String key;

    @Setter
    private String name;

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

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

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

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

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