package com.heyu.api.data.utils;


import com.heyu.api.data.dto.IdCardCodeModel;

import java.util.HashMap;
import java.util.Map;

public class MobileUtils {
    private static final String CHINA_PHONE_NUMBER_REGEX = "^1([3456789])\\d{9}$";


    private static Map<String, IdCardCodeModel> idCardCodeMap = new HashMap<String, IdCardCodeModel>() {{
        //省
        put("11", new IdCardCodeModel("11", 0, "北京市", new HashMap<String, IdCardCodeModel>() {{
            //市
            put("01", new IdCardCodeModel("01", 1, "", new HashMap<String, IdCardCodeModel>(){{
                put("01", new IdCardCodeModel("01", 2, "东城区", null));
                put("02", new IdCardCodeModel("02", 2, "西城区", null));
                put("03", new IdCardCodeModel("03", 2, "崇文区", null));
                put("04", new IdCardCodeModel("04", 2, "宣武区", null));
                put("05", new IdCardCodeModel("05", 2, "朝阳区", null));
                put("06", new IdCardCodeModel("06", 2, "丰台区", null));
                put("07", new IdCardCodeModel("07", 2, "石景山区", null));
                put("08", new IdCardCodeModel("08", 2, "海淀区", null));
                put("09", new IdCardCodeModel("09", 2, "门头沟区", null));
                put("11", new IdCardCodeModel("11", 2, "房山区", null));
            }}));
            //市
            put("02", new IdCardCodeModel("02", 1, "", new HashMap<String, IdCardCodeModel>(){{
                put("21", new IdCardCodeModel("21", 2, "昌平县", null));
                put("22", new IdCardCodeModel("22", 2, "顺义县", null));
                put("23", new IdCardCodeModel("23", 2, "通县", null));
                put("24", new IdCardCodeModel("24", 2, "大兴县", null));
                put("26", new IdCardCodeModel("26", 2, "平谷县", null));
                put("27", new IdCardCodeModel("27", 2, "怀柔县", null));
                put("28", new IdCardCodeModel("28", 2, "密云县", null));
                put("29", new IdCardCodeModel("29", 2, "延庆县", null));
            }}));
        }}));



    }};



    public static boolean validateMobile(String phone) {
        return phone.matches(CHINA_PHONE_NUMBER_REGEX);
    }
}
