package thyyxxk.webserver.constants.sidicts;

import thyyxxk.webserver.utils.StringUtil;

/**
 * @description: 代办人关系
 * @author: DingJie
 * @create: 2021/8/314:49
 */
public enum AgnterRlts {

    SPOUSE("1", "配偶"),

    CHILD("2", "子女"),

    GRAND_CHILD("4", "孙子、孙女，或外孙子、外孙女"),

    PARENT("5", "父母"),

    GRAND_PARENT("6", "祖父母或外祖父母"),

    BROTHER_SISTER("7", "兄、弟、姐、妹"),

    OTHER_RELATIVE("8", "其他亲属"),

    NOT_RELATIVE("9", "非亲属");

    private final String code;
    private final String name;

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

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

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