from datetime import datetime from typing import Generic, TypeVar from pydantic import BaseModel, ConfigDict, Field T = TypeVar("T") class Page(BaseModel, Generic[T]): items: list[T] total: int offset: int limit: int class DocumentResponse(BaseModel): model_config = ConfigDict(from_attributes=True) id: str filename: str file_type: str mime_type: str file_size: int status: str chunk_count: int error_code: str | None error_message: str | None created_at: datetime updated_at: datetime class ChunkResponse(BaseModel): model_config = ConfigDict(from_attributes=True) id: str document_id: str order_index: int content: str page_number: int | None char_count: int created_at: datetime class Pagination(BaseModel): offset: int = Field(default=0, ge=0) limit: int = Field(default=20, ge=1, le=100)