namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Runtime;

/// <summary>
///     Driver-side seam for the gateway's session-less alarm feed. Production wraps
///     <c>MxGatewayClient.StreamAlarmsAsync</c> (<see cref="GatewayGalaxyAlarmFeed"/>);
///     tests substitute a fake to drive synthetic <see cref="GalaxyAlarmTransition"/>
///     events through <see cref="GalaxyDriver"/>'s <c>IAlarmSource</c> bridge without a
///     running gateway.
/// </summary>
/// <remarks>
///     The feed is independent of any worker session — the updated gateway serves
///     alarms from an always-on central monitor, so the feed survives subscription
///     churn and reconnects its own stream on transient transport failures.
/// </remarks>
internal interface IGalaxyAlarmFeed : IAsyncDisposable
{
    /// <summary>
    ///     Fires for every alarm transition the gateway feed delivers — both the
    ///     entries of the initial active-alarm snapshot and every subsequent live
    ///     raise / acknowledge / clear. The OPC UA severity bucket is already mapped.
    /// </summary>
    event EventHandler<GalaxyAlarmTransition>? OnAlarmTransition;

    /// <summary>
    ///     Start consuming the alarm feed on a background task. Idempotent — second
    ///     calls are no-ops while the loop is running.
    /// </summary>
    void Start();
}
