package io.hmit.modules.zlb.constants;


/**
 * 异常枚举类
 * @author Shen && syf0412@vip.qq.com
 * @since 2021/12/6 13:35
 */
public enum IdTypeEnum {
    ID_CARD("ID_CARD",1), // 居⺠身份证
    MAINLAND_TRAVEL_PERMIT_FOR_HONGKONG_AND_MACAO_RESIDENTS("MAINLAND_TRAVEL_PERMIT_FOR_HONGKONG_AND_MACAO_RESIDENTS",4 ), // 港澳居⺠来往内地通⾏
    MAINLAND_TRAVEL_PERMIT_FOR_TAIWAN_RESIDENTS("MAINLAND_TRAVEL_PERMIT_FOR_TAIWAN_RESIDENTS",5), // 台湾居⺠来往⼤陆通⾏证
    FOREIGN_PERMANENT_RESIDENT_ID_CARD("FOREIGN_PERMANENT_RESIDENT_ID_CARD",8), // 外国⼈永久居留身份证
    GANG_AO_TAI_RESIDENCE_CART("GANG_AO_TAI_RESIDENCE_CART",14), // 港澳台居住证
    GANG_AO_ID_CART("GANG_AO_ID_CART",200), // 港澳居⺠居住证
    TAI_ID_CART("TAI_ID_CART",201), // 台湾居⺠居住证


    ;
    private final String type;
    private final int code;


    IdTypeEnum(String type, int code) {
        this.type = type;
        this.code = code;
    }

    public int getCode() {
        return code;
    }

    public String getType() {
        return type;
    }

    // 通过数字获取枚举值
    public static IdTypeEnum getByType(String type) {
        for (IdTypeEnum idTypeEnum : values()) {
            if (idTypeEnum.type.equals(type) ) {
                return idTypeEnum;
            }
        }
        throw new IllegalArgumentException("无效的类型: " + type);
    }

}
