package thyyxxk.webserver.constants;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j;
import thyyxxk.webserver.utils.StringUtil;

@Slf4j
public enum RestrictedDrugLevels {

    UNRESTRICTED_USE_OF_MEDICINES("0", "非限制使用药品"),
    RESTRICTED_USE_OF_MEDICINES("1", "限制使用药品"),
    SPECIAL_USE_MEDICINES("2", "特殊使用药品");

    private final String code;

    private final String name;


    RestrictedDrugLevels(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(String code) {
        if (StringUtil.isBlank(code)) {
            return "";
        }
        for (RestrictedDrugLevels value : RestrictedDrugLevels.values()) {
            if (code.trim().equals(value.getCode())) {
                return value.getName();
            }
        }
        return null;
    }


    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }


}
