"""Vendor adapters package."""

from .base import VendorAdapter
from .gemini import GeminiAdapter
from .glm import GLMAdapter
from .kimi import KimiAdapter
from .mimo import MimoAdapter
from .qwen import QwenAdapter
from .openai import OpenAIAdapter

__all__ = [
    "VendorAdapter",
    "GeminiAdapter",
    "GLMAdapter",
    "KimiAdapter",
    "MimoAdapter",
    "QwenAdapter",
    "OpenAIAdapter",
]

# Adapter class mapping
_ADAPTER_CLASSES = {
    "gemini": GeminiAdapter,
    "glm": GLMAdapter,
    "kimi": KimiAdapter,
    "mimo": MimoAdapter,
    "qwen": QwenAdapter,
    "openai": OpenAIAdapter,
}


def get_adapter(vendor: str, **kwargs) -> VendorAdapter:
    """
    Factory function to get vendor adapter.

    Args:
        vendor: Vendor name (gemini, glm, kimi, mimo, qwen, openai).
        **kwargs: Adapter configuration (api_key, model, base_url).

    Returns:
        Configured VendorAdapter instance.

    Raises:
        ValueError: If vendor is not supported.
    """
    vendor_lower = vendor.lower().strip()

    if vendor_lower not in _ADAPTER_CLASSES:
        from ..registry import get_vendors
        raise ValueError(f"Unsupported vendor: {vendor}. Supported: {get_vendors()}")

    return _ADAPTER_CLASSES[vendor_lower](**kwargs)

