from __future__ import annotations

from typing import Mapping, Sequence

from ..router import RouterLite as _LegacyRouterLite
from .base import Router


class RouterLiteAdapter(Router):
    """Adapter exposing the legacy RouterLite via the new Router interface."""

    def __init__(self) -> None:
        self._router = _LegacyRouterLite()

    def choose(
        self,
        admissible_providers: Sequence[str],
        *,
        session_id: str | None = None,
    ) -> tuple[str, Mapping[str, float], bool]:
        provider, components, sticky = self._router.choose(
            list(admissible_providers), session_id=session_id
        )
        return provider, components, sticky


__all__ = ["RouterLiteAdapter"]
