using Heimdall.Application.Common; using Heimdall.Domain.Entities; namespace Heimdall.Application.Services; /// Strategy for assigning cameras to agents. public enum AssignmentStrategy { /// Distribute cameras evenly across agents. RoundRobin, /// Assign detection-heavy cameras to GPU agents first. GpuPriority, /// Assign to the agent with the fewest cameras. LeastCameras, /// Reassign cameras from an offline agent to online agents. Failover, } /// /// Manages camera-to-agent assignments across a site. /// Supports multiple strategies and failover. /// public interface ICameraAssignmentService { /// /// Assign a single camera to an agent. /// Releases any existing active assignment for this camera first. /// Task AssignCameraAsync(Guid cameraId, Guid agentId, string reason, CancellationToken ct); /// /// Assign all cameras of a site according to the given strategy. /// Returns the number of cameras assigned. /// Task> AssignSiteCamerasAsync(Guid siteId, AssignmentStrategy strategy, CancellationToken ct); /// /// Handle agent failover: reassign all cameras from offlineAgent to the best /// available online agents in the same site. /// Task>> FailoverAgentAsync(Guid offlineAgentId, CancellationToken ct); /// /// Get the currently active assignment for a camera, or null if unassigned. /// Task GetActiveAssignmentAsync(Guid cameraId, CancellationToken ct); /// /// Get all active assignments for a given agent (its current workload). /// Task> GetAgentAssignmentsAsync(Guid agentId, CancellationToken ct); /// /// Get the assignment history for a specific camera. /// Task> GetCameraHistoryAsync(Guid cameraId, CancellationToken ct); /// /// Release a camera from its current agent (makes it unassigned). /// Task ReleaseCameraAsync(Guid cameraId, CancellationToken ct); }