"""Appointment command handlers — Phase 13.1.""" from __future__ import annotations from uuid import UUID from sqlalchemy.ext.asyncio import AsyncSession from app.schemas.appointments import ( AppointmentCreate, AppointmentLifecycleRequest, AppointmentReschedule, AppointmentTypeCreate, AvailabilityWindowCreate, ScheduleCreate, WaitingListEntryCreate, ) from app.services.appointments import ( AppointmentService, AppointmentTypeService, AvailabilityWindowService, ScheduleService, WaitingListService, ) from shared.security import CurrentUser class AppointmentCommands: def __init__(self, session: AsyncSession) -> None: self.schedules = ScheduleService(session) self.availability = AvailabilityWindowService(session) self.types = AppointmentTypeService(session) self.appointments = AppointmentService(session) self.waiting_list = WaitingListService(session) async def create_schedule(self, tenant_id: UUID, body: ScheduleCreate, *, actor: CurrentUser | None): return await self.schedules.create(tenant_id, body, actor=actor) async def create_availability( self, tenant_id: UUID, body: AvailabilityWindowCreate, *, actor: CurrentUser | None ): return await self.availability.create(tenant_id, body, actor=actor) async def create_type(self, tenant_id: UUID, body: AppointmentTypeCreate, *, actor: CurrentUser | None): return await self.types.create(tenant_id, body, actor=actor) async def book(self, tenant_id: UUID, body: AppointmentCreate, *, actor: CurrentUser | None): return await self.appointments.book(tenant_id, body, actor=actor) async def confirm( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor ): return await self.appointments.confirm(tenant_id, appointment_id, body, actor=actor) async def cancel( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor ): return await self.appointments.cancel(tenant_id, appointment_id, body, actor=actor) async def reschedule( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentReschedule, *, actor ): return await self.appointments.reschedule(tenant_id, appointment_id, body, actor=actor) async def mark_no_show( self, tenant_id: UUID, appointment_id: UUID, body: AppointmentLifecycleRequest, *, actor ): return await self.appointments.mark_no_show(tenant_id, appointment_id, body, actor=actor) async def create_waiting_list( self, tenant_id: UUID, body: WaitingListEntryCreate, *, actor: CurrentUser | None ): return await self.waiting_list.create(tenant_id, body, actor=actor)