from typing import Literal

from tests.fixtures.agents.anthropic_agent import AnthropicAgent
from tests.fixtures.agents.base import AgentProtocol
from tests.fixtures.agents.google_agent import GoogleAgent
from tests.fixtures.agents.langchain_agent import LangchainAgent
from tests.fixtures.agents.litellm_agent import LitellmAgent
from tests.fixtures.agents.pydantic_agent import PydanticAgent

VendorType = Literal["anthropic", "google", "langchain", "litellm", "pydantic_ai"]


class AgentFixtures:
    """
    Factory for creating standardized test agents.

    All agents implement the AgentProtocol interface with:
    - ask(question: str) -> str: Synchronous question answering
    - stream(question: str) -> AsyncIterator[str]: Async streaming responses

    This makes tests plug-and-play across different vendor integrations.
    """

    def create(self, vendor: VendorType) -> AgentProtocol:
        """
        Create an agent for the specified vendor.

        Args:
            vendor: The vendor integration to test

        Returns:
            An agent implementing the AgentProtocol interface
        """
        match vendor:
            case "anthropic":
                return AnthropicAgent()
            case "google":
                return GoogleAgent()
            case "langchain":
                return LangchainAgent()
            case "litellm":
                return LitellmAgent()
            case "pydantic_ai":
                return PydanticAgent()
            case _:
                msg = f"Unknown vendor: {vendor}"
                raise ValueError(msg)

    # Convenience methods for direct access
    def create_anthropic_agent(self) -> AnthropicAgent:
        """Create an Anthropic agent"""
        return AnthropicAgent()

    def create_litellm_agent(self) -> LitellmAgent:
        """Create a LiteLLM agent"""
        return LitellmAgent()

    def create_pydantic_agent(self) -> PydanticAgent:
        """Create a Pydantic AI agent"""
        return PydanticAgent()

    def create_langchain_agent(self) -> LangchainAgent:
        """Create a LangChain agent"""
        return LangchainAgent()

    def create_google_agent(self) -> GoogleAgent:
        """Create a Google GenAI agent"""
        return GoogleAgent()
