import uuid from sqlalchemy import String, Integer, Boolean from sqlalchemy.orm import Mapped, mapped_column from sqlalchemy.dialects.postgresql import UUID from app.db.session import Base from app.models.common import UUIDMixin, TimestampMixin class Attachment(Base, UUIDMixin, TimestampMixin): __tablename__ = "attachments" request_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), index=True, nullable=False) message_id: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True), index=True, nullable=True) file_name: Mapped[str] = mapped_column(String(300), nullable=False) mime_type: Mapped[str] = mapped_column(String(150), nullable=False) size_bytes: Mapped[int] = mapped_column(Integer, nullable=False) s3_key: Mapped[str] = mapped_column(String(500), nullable=False) immutable: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)