package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 职业
 * @author: DingJie
 * @create: 2021/7/2411:37
 */
public enum Prfs {

    NATIONAL_CIVIL_SERVANT("11", "国家公务员"),

    PROFESSIONAL_TECHNICIANS("13", "专业技术人员"),

    STAFF_MEMBER("17", "职员"),

    ENTERPRISE_MANAGERS("21", "企业管理人员"),

    WORKER("24", "工人"),

    FARMER("27", "农民"),

    STUDENT("31", "学生"),

    SERVICEMEN("37", "现役军人"),

    FREELANCE("51", "自由职业者"),

    INDIVIDUAL_OPERATORS("54", "个体经营者"),

    UNEMPLOYED("70", "无业人员"),

    RETIRED("80", "退（离）休人员"),

    OTHERS("90", "其他");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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