"""
Constants and mappings used throughout the geobank package.
"""

# Mapping from ISO 639-1 (2-letter) to ISO 639-2 (3-letter) codes
# This is used to match geonames language codes to restcountries language codes
ISO_639_1_TO_2 = {
    "aa": "aar",
    "ab": "abk",
    "af": "afr",
    "ak": "aka",
    "sq": "sqi",
    "am": "amh",
    "ar": "ara",
    "an": "arg",
    "hy": "hye",
    "as": "asm",
    "av": "ava",
    "ae": "ave",
    "ay": "aym",
    "az": "aze",
    "ba": "bak",
    "bm": "bam",
    "eu": "eus",
    "be": "bel",
    "bn": "ben",
    "bh": "bih",
    "bi": "bis",
    "bs": "bos",
    "br": "bre",
    "bg": "bul",
    "my": "mya",
    "ca": "cat",
    "ch": "cha",
    "ce": "che",
    "zh": "zho",
    "cu": "chu",
    "cv": "chv",
    "kw": "cor",
    "co": "cos",
    "cr": "cre",
    "cs": "ces",
    "da": "dan",
    "dv": "div",
    "nl": "nld",
    "dz": "dzo",
    "en": "eng",
    "eo": "epo",
    "et": "est",
    "ee": "ewe",
    "fo": "fao",
    "fj": "fij",
    "fi": "fin",
    "fr": "fra",
    "fy": "fry",
    "ff": "ful",
    "ka": "kat",
    "de": "deu",
    "gd": "gla",
    "ga": "gle",
    "gl": "glg",
    "gv": "glv",
    "el": "ell",
    "gn": "grn",
    "gu": "guj",
    "ht": "hat",
    "ha": "hau",
    "he": "heb",
    "hz": "her",
    "hi": "hin",
    "ho": "hmo",
    "hr": "hrv",
    "hu": "hun",
    "ig": "ibo",
    "is": "isl",
    "io": "ido",
    "ii": "iii",
    "iu": "iku",
    "ie": "ile",
    "ia": "ina",
    "id": "ind",
    "ik": "ipk",
    "it": "ita",
    "jv": "jav",
    "ja": "jpn",
    "kl": "kal",
    "kn": "kan",
    "ks": "kas",
    "kr": "kau",
    "kk": "kaz",
    "km": "khm",
    "ki": "kik",
    "rw": "kin",
    "ky": "kir",
    "kv": "kom",
    "kg": "kon",
    "ko": "kor",
    "kj": "kua",
    "ku": "kur",
    "lo": "lao",
    "la": "lat",
    "lv": "lav",
    "li": "lim",
    "ln": "lin",
    "lt": "lit",
    "lb": "ltz",
    "lu": "lub",
    "lg": "lug",
    "mk": "mkd",
    "mh": "mah",
    "ml": "mal",
    "mi": "mri",
    "mr": "mar",
    "ms": "msa",
    "mg": "mlg",
    "mt": "mlt",
    "mn": "mon",
    "na": "nau",
    "nv": "nav",
    "nr": "nbl",
    "nd": "nde",
    "ng": "ndo",
    "ne": "nep",
    "nn": "nno",
    "nb": "nob",
    "no": "nor",
    "ny": "nya",
    "oc": "oci",
    "oj": "oji",
    "or": "ori",
    "om": "orm",
    "os": "oss",
    "pa": "pan",
    "fa": "fas",
    "pi": "pli",
    "pl": "pol",
    "pt": "por",
    "ps": "pus",
    "qu": "que",
    "rm": "roh",
    "ro": "ron",
    "rn": "run",
    "ru": "rus",
    "sg": "sag",
    "sa": "san",
    "si": "sin",
    "sk": "slk",
    "sl": "slv",
    "se": "sme",
    "sm": "smo",
    "sn": "sna",
    "sd": "snd",
    "so": "som",
    "st": "sot",
    "es": "spa",
    "sc": "srd",
    "sr": "srp",
    "ss": "ssw",
    "su": "sun",
    "sw": "swa",
    "sv": "swe",
    "ty": "tah",
    "ta": "tam",
    "tt": "tat",
    "te": "tel",
    "tg": "tgk",
    "tl": "tgl",
    "th": "tha",
    "bo": "bod",
    "ti": "tir",
    "to": "ton",
    "tn": "tsn",
    "ts": "tso",
    "tk": "tuk",
    "tr": "tur",
    "tw": "twi",
    "ug": "uig",
    "uk": "ukr",
    "ur": "urd",
    "uz": "uzb",
    "ve": "ven",
    "vi": "vie",
    "vo": "vol",
    "cy": "cym",
    "wa": "wln",
    "wo": "wol",
    "xh": "xho",
    "yi": "yid",
    "yo": "yor",
    "za": "zha",
    "zu": "zul",
}

# Reverse mapping: ISO 639-2 (3-letter) to ISO 639-1 (2-letter)
ISO_639_2_TO_1 = {v: k for k, v in ISO_639_1_TO_2.items()}


# Geonames URLs
GEONAMES_COUNTRY_INFO_URL = (
    "https://raw.githubusercontent.com/ali-hv/geobank-data/refs/heads/main/countryInfo.tsv"
)
GEONAMES_REGION_INFO_URL = (
    "https://raw.githubusercontent.com/ali-hv/geobank-data/refs/heads/main/regionInfo.tsv"
)
GEONAMES_CITIES_URL_TEMPLATE = (
    "https://raw.githubusercontent.com/ali-hv/geobank-data/refs/heads/main/cities{population}.zip"
)

# Geobank Translations URL
GEOBANK_TRANSLATIONS_URL = (
    "https://raw.githubusercontent.com/ali-hv/geobank-data/refs/heads/main/translations.zip"
)

# RestCountries URLs
RESTCOUNTRIES_LANGUAGES_URL = "https://restcountries.com/v3.1/all?fields=languages"
RESTCOUNTRIES_CURRENCIES_URL = "https://restcountries.com/v3.1/all?fields=currencies"
RESTCOUNTRIES_FLAGS_URL = "https://restcountries.com/v3.1/all?fields=cca2,flags"
