from typing import List, Optional, Any, Dict
from pydantic import BaseModel, Field

class QueryRequest(BaseModel):
    user_input: str = Field(..., description="La pregunta del usuario sobre vuelos.")

class BaseResponse(BaseModel):
    status: str
    message: Optional[str] = None

class HealthResponse(BaseResponse):
    agent_ready: bool
    mcp_url: str

class AgentQueryResponse(BaseModel):
    input: str
    response: str
    used_tools: List[str] = Field(default_factory=list)
    history_length: int = 0
    metadata: Optional[Dict[str, Any]] = None

    class Config:
        json_schema_extra = {
            "example": {
                "input": "¿Qué vuelos hay hoy?",
                "response": "Hay 3 vuelos de Avianca...",
                "used_tools": ["getSalidas"],
                "history_length": 10
            }
        }

class GenericResponse(BaseResponse):
    data: Optional[Any] = None

class ErrorResponse(BaseModel):
    error: str
    details: Optional[str] = None
