using ScadaLink.Commons.Types.Enums;
namespace ScadaLink.DeploymentManager;
///
/// Payload describing a single deployment-record status change. Kept small —
/// just the deployment identity, the owning instance, and the new status — so
/// it is cheap to raise on the hot path and cheap for subscribers to handle.
///
/// The unique deployment ID whose status changed.
/// The instance the deployment record belongs to.
/// The status the deployment record was just written with.
public readonly record struct DeploymentStatusChange(
string DeploymentId,
int InstanceId,
DeploymentStatus Status);
///
/// CentralUI-006: push-based deployment-status change notification.
///
/// The design (Component-CentralUI "Real-Time Updates") requires deployment
/// status transitions to push to the UI immediately via SignalR, with no
/// polling. raises
/// whenever it writes a
/// status; the Central UI's deployment-status page subscribes to it and
/// re-renders over its existing Blazor Server SignalR circuit.
///
/// Registered as a DI singleton (see )
/// so the scoped and the Blazor circuit's
/// scoped page component share the same instance — both run in the same
/// central Host process.
///
public interface IDeploymentStatusNotifier
{
///
/// Raised after a deployment record's status has been written. Handlers run
/// synchronously on the caller's thread; subscribers must not block and
/// should marshal any UI work onto their own dispatcher.
///
event Action? StatusChanged;
///
/// Raises . Called by
/// at every point a deployment record's status is persisted. A throwing
/// subscriber must not break the deployment pipeline, so handler exceptions
/// are swallowed by the implementation.
///
void NotifyStatusChanged(DeploymentStatusChange change);
}