"""Anime streaming sites (catalogs) downloaders"""
from .base import BaseAnimeSite
# Import all anime site downloaders
from .animesama import AnimeSamaDownloader
from .nekosama import NekoSamaDownloader
from .animeultime import AnimeUltimeDownloader
from .vostfree import VostfreeDownloader
from .frenchmanga import FrenchMangaDownloader

__all__ = [
    "BaseAnimeSite",
    "AnimeSamaDownloader",
    "NekoSamaDownloader",
    "AnimeUltimeDownloader",
    "VostfreeDownloader",
    "FrenchMangaDownloader",
]


def get_anime_site(url: str) -> BaseAnimeSite:
    """Factory function to get the appropriate anime site for a URL"""
    sites = [
        AnimeSamaDownloader(),
        AnimeUltimeDownloader(),
        NekoSamaDownloader(),
        VostfreeDownloader(),
        FrenchMangaDownloader(),
    ]

    for site in sites:
        if site.can_handle(url):
            return site

    # Return None if no match (should not happen in normal flow)
    return None
