"""Every opening hours collector the app knows about, in one place, and which airport each covers.

An airport with no collector here is one whose operator refused, disallowed, or draws its shop
pages in the browser (the verdicts per domain are in `.logs/runs/hours-robots-<date>.md`); its
hours are entered by hand (`python -m app.cli hours set`). Switching a platform off is deleting
its line here.
"""

from app.services.hours.base import HoursCollector
from app.services.hours.dublin import DublinAirportHours
from app.services.hours.heathrow import HeathrowHours
from app.services.hours.toronto import TorontoPearsonHours

HOURS_COLLECTORS: tuple[HoursCollector, ...] = (
    HeathrowHours(),
    DublinAirportHours(),
    TorontoPearsonHours(),
)


def collector_for(iata: str) -> HoursCollector | None:
    code = iata.upper()
    return next((c for c in HOURS_COLLECTORS if code in c.airports), None)


def collected_airports() -> list[str]:
    return sorted({code for c in HOURS_COLLECTORS for code in c.airports})
