from typing import Literal from uuid import UUID from pydantic import BaseModel, ConfigDict from utils.dates import UtcDatetime class VariantResponse(BaseModel): # Производные варианты (thumbnail и др.) появятся с lab5; в lab4 список всегда пуст. name: Literal["thumbnail", "crop", "optimized"] content_type: Literal["image/jpeg", "image/png", "image/webp"] size_bytes: int width: int height: int sha256: str class AttachmentResponse(BaseModel): # Ключ объекта в S3 и прочие внутренние поля наружу не отдаются. model_config = ConfigDict(from_attributes=True) id: UUID chat_id: UUID owner_id: UUID filename: str content_type: Literal["image/png", "image/jpeg"] size_bytes: int sha256: str status: Literal["ready"] variants: list[VariantResponse] = [] error_code: str | None = None created_at: UtcDatetime updated_at: UtcDatetime