package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 险种类型
 * @author: DingJie
 * @create: 2021/7/129:12
 */
public enum Insutype {

    BASIC_MEDICAL_INSURANCE_FOR_EMPLOYEES("310", "职工基本医疗保险"),

    MEDICAID_FOR_CIVIL_SERVANTS("320", "公务员医疗补助"),

    LARGE_MEDICAL_EXPENSES_SUBSIDY("330", "大额医疗费用补助"),

    MEDICAL_SECURITY_FOR_RETIRED_PERSONNEL("340", "离休人员医疗保障"),

    MEDICAID_FOR_DISABLED_SOLDIERS("350", "一至六级残废军人医疗补助"),

    MEDICAID_FOR_ELDERLY_RED_ARMY("360", "老红军医疗保障"),

    ENTERPRISE_SUPPLEMENTARY_MEDICAL_INSURANCE("370", "企业补充医疗保险"),

    NEW_RURAL_COOPERATIVE_MEDICAL_SYSTEM("380", "新型农村合作医疗"),

    BASIC_MEDICAL_INSURANCE_FOR_RURAL_RESIDENTS("390", "城乡居民基本医疗保险"),

    BASIC_MEDICAL_INSURANCE_FOR_URBAN_RESIDENTS("391", "城镇居民基本医疗保险"),

    SERIOUS_ILLNESS_MEDICAL_INSURANCE_FOR_URBAN_AND_RURAL_RESIDENTS("392", "城乡居民大病医疗保险"),

    MEDICAL_SECURITY_FOR_OTHER_SPECIAL_PERSONNEL("399", "其他特殊人员医疗保障"),

    LONG_TERM_CARE_INSURANCE("410", "长期照护保险"),

    MATERNITY_INSURANCE("510", "生育保险");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Insutype get(String code) {
        if (StringUtil.isBlank(code)) {
            return null;
        }
        for (Insutype insutype : Insutype.values()) {
            if (code.trim().equals(insutype.getCode())) {
                return insutype;
            }
        }
        return null;
    }

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