"""
随机地址库默认地址数据。

功能：
1. 提供覆盖 34 个省级行政区的默认随机地址分组数据。
2. 为数据库启动自检时补齐全局随机地址提供统一来源。
"""

from __future__ import annotations

REMOVED_PUBLISH_ADDRESS_PREFIXES: tuple[str, ...] = (
    "台湾省",
    "香港特别行政区",
    "澳门特别行政区",
)

DEFAULT_PUBLISH_ADDRESS_GROUPS: tuple[tuple[str, tuple[str, ...]], ...] = (
    ("北京市", ("朝阳区", "海淀区", "丰台区", "通州区", "大兴区")),
    ("天津市", ("和平区", "河西区", "南开区", "西青区", "滨海新区")),
    ("河北省", ("石家庄市长安区", "唐山市路北区", "保定市莲池区", "廊坊市广阳区", "沧州市运河区")),
    ("山西省", ("太原市小店区", "大同市平城区", "晋中市榆次区", "运城市盐湖区", "临汾市尧都区")),
    ("内蒙古自治区", ("呼和浩特市赛罕区", "包头市昆都仑区", "鄂尔多斯市东胜区", "赤峰市红山区", "呼伦贝尔市海拉尔区")),
    ("辽宁省", ("沈阳市和平区", "大连市中山区", "鞍山市铁东区", "锦州市太和区", "营口市站前区")),
    ("吉林省", ("长春市南关区", "吉林市船营区", "四平市铁西区", "延边州延吉市", "通化市东昌区")),
    ("黑龙江省", ("哈尔滨市南岗区", "齐齐哈尔市龙沙区", "牡丹江市东安区", "大庆市萨尔图区", "佳木斯市向阳区")),
    ("上海市", ("浦东新区", "闵行区", "徐汇区", "宝山区", "松江区")),
    ("江苏省", ("南京市建邺区", "苏州市工业园区", "无锡市滨湖区", "徐州市云龙区", "南通市崇川区")),
    ("浙江省", ("杭州市西湖区", "宁波市鄞州区", "温州市鹿城区", "嘉兴市南湖区", "金华市义乌市")),
    ("安徽省", ("合肥市蜀山区", "芜湖市镜湖区", "蚌埠市蚌山区", "阜阳市颍州区", "安庆市迎江区")),
    ("福建省", ("福州市鼓楼区", "厦门市思明区", "泉州市丰泽区", "漳州市芗城区", "莆田市城厢区")),
    ("江西省", ("南昌市红谷滩区", "赣州市章贡区", "九江市濂溪区", "上饶市信州区", "宜春市袁州区")),
    ("山东省", ("济南市历下区", "青岛市市南区", "烟台市芝罘区", "潍坊市奎文区", "临沂市兰山区")),
    ("河南省", ("郑州市金水区", "洛阳市洛龙区", "南阳市宛城区", "新乡市红旗区", "商丘市睢阳区")),
    ("湖北省", ("武汉市武昌区", "宜昌市西陵区", "襄阳市樊城区", "荆州市沙市区", "黄石市黄石港区")),
    ("湖南省", ("长沙市岳麓区", "株洲市天元区", "湘潭市岳塘区", "岳阳市岳阳楼区", "常德市武陵区")),
    ("广东省", ("广州市天河区", "深圳市南山区", "佛山市南海区", "东莞市南城街道", "珠海市香洲区")),
    ("广西壮族自治区", ("南宁市青秀区", "柳州市城中区", "桂林市秀峰区", "北海市海城区", "玉林市玉州区")),
    ("海南省", ("海口市龙华区", "三亚市吉阳区", "儋州市那大镇", "琼海市嘉积镇", "文昌市文城镇")),
    ("重庆市", ("渝中区", "江北区", "南岸区", "渝北区", "九龙坡区")),
    ("四川省", ("成都市武侯区", "绵阳市涪城区", "德阳市旌阳区", "乐山市市中区", "南充市顺庆区")),
    ("贵州省", ("贵阳市观山湖区", "遵义市汇川区", "六盘水市钟山区", "毕节市七星关区", "安顺市西秀区")),
    ("云南省", ("昆明市五华区", "曲靖市麒麟区", "玉溪市红塔区", "大理州大理市", "西双版纳州景洪市")),
    ("西藏自治区", ("拉萨市城关区", "日喀则市桑珠孜区", "林芝市巴宜区", "昌都市卡若区", "山南市乃东区")),
    ("陕西省", ("西安市雁塔区", "咸阳市秦都区", "宝鸡市金台区", "榆林市榆阳区", "渭南市临渭区")),
    ("甘肃省", ("兰州市城关区", "天水市秦州区", "酒泉市肃州区", "庆阳市西峰区", "张掖市甘州区")),
    ("青海省", ("西宁市城西区", "海东市乐都区", "海西州格尔木市", "海南州共和县", "玉树州玉树市")),
    ("宁夏回族自治区", ("银川市金凤区", "石嘴山市大武口区", "吴忠市利通区", "固原市原州区", "中卫市沙坡头区")),
    ("新疆维吾尔自治区", ("乌鲁木齐市水磨沟区", "克拉玛依市克拉玛依区", "喀什地区喀什市", "伊犁州伊宁市", "巴音郭楞州库尔勒市")),
)


def build_default_publish_addresses() -> list[str]:
    """展开默认随机地址列表。"""
    addresses: list[str] = []
    seen: set[str] = set()

    for province_name, city_districts in DEFAULT_PUBLISH_ADDRESS_GROUPS:
        for city_district in city_districts:
            address = f"{province_name}{city_district}".strip()
            if not address or address in seen:
                continue
            seen.add(address)
            addresses.append(address)

    return addresses
