from pydantic import BaseModel, Field
from typing import Literal, Optional

# --- Chat Schemas ---

class ChatRequest(BaseModel):
    """Defines the shape of a request to the /chat endpoint."""
    prompt: str = Field(..., min_length=1, description="The user's question or prompt.")
    model: Literal["deepseek", "gemini"] = Field("deepseek", description="The AI model to use.")

class ChatResponse(BaseModel):
    """Defines the shape of a successful response from the /chat endpoint."""
    answer: str
    model_used: str

# --- Document Schemas ---

class DocumentCreate(BaseModel):
    """Defines the shape for creating a new document."""
    title: str
    text: str
    source_url: Optional[str] = None
    author: Optional[str] = None
    user_id: str = "default_user"

class DocumentResponse(BaseModel):
    """Defines the response after creating a document."""
    message: str