"""站点级配置（URL / host / 库名）。

加新站点：在 SITE_REGISTRY 里加一行。
其他代码都通过 SITE_REGISTRY[site] 或 helper 函数取值，不再 if-elif。
"""
from typing import Dict, TypedDict


class SiteInfo(TypedDict):
    url: str
    host: str
    db: str   # PG 库名（selection / selection_uk / ...）


SITE_REGISTRY: Dict[str, SiteInfo] = {
    "us": {"url": "https://www.amazon.com/",   "host": "www.amazon.com",   "db": "selection"},
    "uk": {"url": "https://www.amazon.co.uk/", "host": "www.amazon.co.uk", "db": "selection_uk"},
    "de": {"url": "https://www.amazon.de/",    "host": "www.amazon.de",    "db": "selection_de"},
    "fr": {"url": "https://www.amazon.fr/",    "host": "www.amazon.fr",    "db": "selection_fr"},
    "es": {"url": "https://www.amazon.es/",    "host": "www.amazon.es",    "db": "selection_es"},
    "it": {"url": "https://www.amazon.it/",    "host": "www.amazon.it",    "db": "selection_it"},
}

ALL_SITES = tuple(SITE_REGISTRY)


def site_url(site: str) -> str:
    return SITE_REGISTRY[site]["url"]


def site_host(site: str) -> str:
    return SITE_REGISTRY[site]["host"]


def site_db(site: str) -> str:
    return SITE_REGISTRY[site]["db"]
