from pydantic import BaseModel
from datetime import datetime


class MessageCreate(BaseModel):
    content: str


class MessageOut(BaseModel):
    id: str
    role: str
    content: str
    model: str | None
    tokens_used: int | None
    attachments: list[dict] | None = None
    created_at: datetime

    model_config = {"from_attributes": True}


class ConversationCreate(BaseModel):
    title: str | None = None


class ConversationOut(BaseModel):
    id: str
    title: str | None
    message_count: int
    created_at: datetime
    updated_at: datetime

    model_config = {"from_attributes": True}


class ChatRequest(BaseModel):
    message: str
    conversation_id: str | None = None
    agent_id: str | None = None
    model_name: str | None = None
    file_ids: list[str] = []


class ChatResponse(BaseModel):
    conversation_id: str
    message_id: str
    content: str
    agent_name: str
    model_name: str | None = None
