import uuid from datetime import datetime from sqlalchemy import String, DateTime, Boolean, Text, ForeignKey from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.dialects.postgresql import UUID from app.database import Base class RenderTemplate(Base): __tablename__ = "render_templates" id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) name: Mapped[str] = mapped_column(String(300), nullable=False) category_key: Mapped[str | None] = mapped_column(String(100), nullable=True) output_type_id: Mapped[uuid.UUID | None] = mapped_column( UUID(as_uuid=True), ForeignKey("output_types.id", ondelete="SET NULL"), nullable=True ) blend_file_path: Mapped[str] = mapped_column(Text, nullable=False) original_filename: Mapped[str] = mapped_column(String(500), nullable=False) target_collection: Mapped[str] = mapped_column(String(200), nullable=False, default="Product", server_default="Product") material_replace_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false") lighting_only: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false") shadow_catcher_enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, server_default="false") camera_orbit: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True, server_default="true") is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True, server_default="true") created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, server_default="now()") updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, server_default="now()", onupdate=datetime.utcnow) output_type = relationship("OutputType", lazy="joined")