namespace ZB.MOM.WW.MxGateway.Server.Dashboard.Hubs;

/// <summary>
/// In-process subscription seam on the dashboard event mirror. Implemented by
/// <see cref="DashboardEventBroadcaster"/> alongside
/// <see cref="IDashboardEventBroadcaster"/>.
/// </summary>
/// <remarks>
/// The interactive-server dashboard runs in the same process as the broadcaster,
/// so a session-details page has no reason to open a loopback SignalR connection
/// back to <see cref="EventsHub"/> — mint a hub token, negotiate, hold a
/// WebSocket, and serialize every event — just to read events the broadcaster
/// already holds. It subscribes here instead. The registry gate stays honest
/// either way: an in-process subscription registers a synthetic connection id
/// with <see cref="EventsHubViewerRegistry"/> exactly as the hub registers a real
/// one, so <see cref="IDashboardEventBroadcaster.Publish"/> keeps skipping the
/// redaction clone for sessions nobody is watching.
/// <para>
/// It is a separate interface rather than a member of
/// <see cref="IDashboardEventBroadcaster"/> because publishing and consuming are
/// different roles: the session pipeline only ever publishes, and its test
/// doubles should not have to implement a subscription feed.
/// </para>
/// </remarks>
public interface IDashboardSessionEventSubscriber
{
    /// <summary>Opens an in-process feed of the session's mirrored events.</summary>
    /// <param name="sessionId">Session id whose events the caller wants.</param>
    /// <returns>
    /// The subscription. Dispose it to stop the feed and release the viewer
    /// registration that keeps the mirror enabled for this session.
    /// </returns>
    IDashboardEventSubscription Subscribe(string sessionId);
}
