"""Template command handlers — Phase 11.4.""" from __future__ import annotations from uuid import UUID from sqlalchemy.ext.asyncio import AsyncSession from app.schemas.templates import ( ExperienceTemplateCreate, ExperienceTemplateUpdate, ExperienceTemplateVersionCreate, ExperienceTemplateVersionUpdate, TemplateInstantiateRequest, ) from app.services.templates import ExperienceTemplateService from shared.security import CurrentUser class TemplateCommands: def __init__(self, session: AsyncSession) -> None: self.service = ExperienceTemplateService(session) async def create_template( self, tenant_id: UUID, body: ExperienceTemplateCreate, *, actor: CurrentUser | None ): return await self.service.create_template(tenant_id, body, actor=actor) async def update_template( self, tenant_id: UUID, template_id: UUID, body: ExperienceTemplateUpdate, *, actor: CurrentUser | None, ): return await self.service.update_template( tenant_id, template_id, body, actor=actor ) async def activate_template( self, tenant_id: UUID, template_id: UUID, *, actor: CurrentUser | None ): return await self.service.activate_template(tenant_id, template_id, actor=actor) async def deprecate_template( self, tenant_id: UUID, template_id: UUID, *, actor: CurrentUser | None ): return await self.service.deprecate_template( tenant_id, template_id, actor=actor ) async def archive_template( self, tenant_id: UUID, template_id: UUID, *, actor: CurrentUser | None ): return await self.service.archive_template(tenant_id, template_id, actor=actor) async def soft_delete_template( self, tenant_id: UUID, template_id: UUID, *, actor: CurrentUser | None ): return await self.service.soft_delete_template( tenant_id, template_id, actor=actor ) async def create_version( self, tenant_id: UUID, body: ExperienceTemplateVersionCreate, *, actor: CurrentUser | None, ): return await self.service.create_version(tenant_id, body, actor=actor) async def update_version( self, tenant_id: UUID, version_id: UUID, body: ExperienceTemplateVersionUpdate, *, actor: CurrentUser | None, ): return await self.service.update_version( tenant_id, version_id, body, actor=actor ) async def publish_version( self, tenant_id: UUID, version_id: UUID, *, actor: CurrentUser | None ): return await self.service.publish_version(tenant_id, version_id, actor=actor) async def retire_version( self, tenant_id: UUID, version_id: UUID, *, actor: CurrentUser | None ): return await self.service.retire_version(tenant_id, version_id, actor=actor) async def instantiate( self, tenant_id: UUID, body: TemplateInstantiateRequest, *, actor: CurrentUser | None, ): return await self.service.instantiate(tenant_id, body, actor=actor)