from typing import Literal

from pydantic import BaseModel, Field


class AssistantMessage(BaseModel):
    role: Literal["user", "assistant"]
    content: str = Field(min_length=1)


class AssistantChatRequest(BaseModel):
    message: str = Field(min_length=1)
    thread_id: str | None = None
    conversation: list[AssistantMessage] = Field(default_factory=list)


class AssistantChatResponse(BaseModel):
    assistant_name: str
    reply: str
    model: str
    assistant_surface: Literal["home", "documents", "menu"] = "home"
    thread_id: str | None = None
    updated_at: str | None = None


class AssistantThreadResponse(BaseModel):
    assistant_name: str
    assistant_surface: Literal["home", "documents", "menu"] = "home"
    thread_id: str | None = None
    updated_at: str | None = None
    messages: list[AssistantMessage] = Field(default_factory=list)
