"""Dispatch command handlers — Phase 10.5.""" from __future__ import annotations from uuid import UUID from sqlalchemy.ext.asyncio import AsyncSession from app.schemas.dispatch import ( DispatchJobCreate, DispatchJobStatusRequest, DispatchJobUpdate, JobAssignmentCreate, JobAssignmentUpdate, ) from app.services.dispatch import DispatchJobService, JobAssignmentService from shared.security import CurrentUser class DispatchCommands: def __init__(self, session: AsyncSession) -> None: self.jobs = DispatchJobService(session) self.assignments = JobAssignmentService(session) async def create_job( self, tenant_id: UUID, body: DispatchJobCreate, *, actor: CurrentUser | None ): return await self.jobs.create(tenant_id, body, actor=actor) async def update_job( self, tenant_id: UUID, job_id: UUID, body: DispatchJobUpdate, *, actor: CurrentUser | None ): return await self.jobs.update(tenant_id, job_id, body, actor=actor) async def apply_status( self, tenant_id: UUID, job_id: UUID, body: DispatchJobStatusRequest, *, actor: CurrentUser | None, ): return await self.jobs.apply_status(tenant_id, job_id, body, actor=actor) async def delete_job( self, tenant_id: UUID, job_id: UUID, *, actor: CurrentUser | None ): return await self.jobs.soft_delete(tenant_id, job_id, actor=actor) async def create_assignment( self, tenant_id: UUID, body: JobAssignmentCreate, *, actor: CurrentUser | None ): return await self.assignments.create(tenant_id, body, actor=actor) async def update_assignment( self, tenant_id: UUID, assignment_id: UUID, body: JobAssignmentUpdate, *, actor: CurrentUser | None, ): return await self.assignments.update(tenant_id, assignment_id, body, actor=actor)