using ZB.MOM.WW.OtOpcUa.Commons.Messages.Drivers;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;
///
/// Singleton last-snapshot-per-(instance, host) cache of driver resilience status
/// (breaker open / consecutive failures / in-flight depth). Populated by
/// DriverResilienceStatusBridge as it forwards driver-resilience-status DPS
/// messages; read in-process by the driver status panel's resilience section via
/// + . Mirrors
/// — the panel reads this singleton directly instead of
/// opening a self-targeted SignalR connection (which a server-side Blazor component cannot reach
/// behind a reverse proxy).
///
public interface IDriverResilienceStatusStore
{
/// Stores or replaces the last-known resilience snapshot for a (instance, host) pair.
/// The resilience status snapshot to store.
void Upsert(DriverResilienceStatusChanged snapshot);
/// Returns every stored host snapshot for one driver instance (empty if none).
/// The driver instance's stable logical ID.
/// The per-host resilience snapshots for that instance.
IReadOnlyList GetForInstance(string driverInstanceId);
/// Returns a point-in-time snapshot of every tracked (instance, host) pair.
/// A read-only collection of the last-known resilience snapshot for each pair.
IReadOnlyCollection GetAll();
///
/// Raised after every with the just-stored snapshot. Lets the Blazor Server
/// driver status panel receive live updates by reading this singleton directly. Handlers run on
/// the caller's thread (the bridge actor), so subscribers must marshal to their own sync context.
///
event Action? SnapshotChanged;
}