"""Routing command handlers — Phase 10.6.""" from __future__ import annotations from uuid import UUID from sqlalchemy.ext.asyncio import AsyncSession from app.schemas.routing import ( OptimizationRunCreate, RoutePlanCreate, RoutePlanUpdate, RouteStopCreate, ) from app.services.routing import OptimizationRunService, RoutePlanService from shared.security import CurrentUser class RoutingCommands: def __init__(self, session: AsyncSession) -> None: self.routes = RoutePlanService(session) self.optimization = OptimizationRunService(session) async def create_route( self, tenant_id: UUID, body: RoutePlanCreate, *, actor: CurrentUser | None ): return await self.routes.create(tenant_id, body, actor=actor) async def update_route( self, tenant_id: UUID, plan_id: UUID, body: RoutePlanUpdate, *, actor: CurrentUser | None ): return await self.routes.update(tenant_id, plan_id, body, actor=actor) async def delete_route( self, tenant_id: UUID, plan_id: UUID, *, actor: CurrentUser | None ): return await self.routes.soft_delete(tenant_id, plan_id, actor=actor) async def add_stop( self, tenant_id: UUID, plan_id: UUID, body: RouteStopCreate, *, actor: CurrentUser | None, ): return await self.routes.add_stop(tenant_id, plan_id, body, actor=actor) async def start_optimization( self, tenant_id: UUID, body: OptimizationRunCreate, *, actor: CurrentUser | None ): return await self.optimization.start(tenant_id, body, actor=actor)