"""Video hosting services (players) downloaders"""
from .base import BaseVideoPlayer
# Import all video player downloaders
from .doodstream import DoodStreamDownloader
from .sibnet import SibnetDownloader
from .vidmoly import VidMolyDownloader
from .sendvid import SendVidDownloader
from .lpayer import LpayerDownloader
from .unfichier import UnFichierDownloader
from .uptobox import UptoboxDownloader
from .rapidfile import RapidFileDownloader
from .vidzy import VidzyDownloader
from .luluv import LuLuvidDownloader
from .uqload import UqloadDownloader
from .smoothpre import SmoothpreDownloader

__all__ = [
    "BaseVideoPlayer",
    "DoodStreamDownloader",
    "SibnetDownloader",
    "VidMolyDownloader",
    "SendVidDownloader",
    "LpayerDownloader",
    "UnFichierDownloader",
    "UptoboxDownloader",
    "RapidFileDownloader",
    "VidzyDownloader",
    "LuLuvidDownloader",
    "UqloadDownloader",
    "SmoothpreDownloader",
]


def get_video_player(url: str) -> BaseVideoPlayer:
    """Factory function to get the appropriate video player for a URL"""
    players = [
        DoodStreamDownloader(),
        SibnetDownloader(),
        VidMolyDownloader(),
        SendVidDownloader(),
        LpayerDownloader(),
        UnFichierDownloader(),
        UptoboxDownloader(),
        RapidFileDownloader(),
        VidzyDownloader(),
        LuLuvidDownloader(),
        UqloadDownloader(),
        SmoothpreDownloader(),
    ]

    for player in players:
        if player.can_handle(url):
            return player

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