"""Appointment command handlers — Phase 14.1.""" from __future__ import annotations from uuid import UUID from sqlalchemy.ext.asyncio import AsyncSession from app.models.types import AppointmentLifecycleAction from app.schemas.appointment_core import ( AppointmentCreate, AppointmentLifecycleRequest, AppointmentUpdate, ) from app.services.appointment_core import AppointmentCoreService from shared.security import CurrentUser class AppointmentCommands: def __init__(self, session: AsyncSession) -> None: self.service = AppointmentCoreService(session) async def create(self, tenant_id: UUID, body: AppointmentCreate, *, actor: CurrentUser | None): return await self.service.create(tenant_id, body, actor=actor) async def update( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentUpdate, *, actor: CurrentUser | None ): return await self.service.update(tenant_id, appointment_id, body, actor=actor) async def confirm( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.CONFIRM, body, actor=actor ) async def check_in( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.CHECK_IN, body, actor=actor ) async def start( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.START, body, actor=actor ) async def complete( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.COMPLETE, body, actor=actor ) async def cancel( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.CANCEL, body, actor=actor ) async def no_show( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor: CurrentUser | None ): return await self.service.apply_lifecycle( tenant_id, appointment_id, AppointmentLifecycleAction.NO_SHOW, body, actor=actor )