using System.Diagnostics.CodeAnalysis;
namespace ZB.MOM.WW.MxGateway.Server.Sessions;
///
/// Registry for managing active gateway sessions.
///
public interface ISessionRegistry
{
///
/// Total number of sessions (open or closed) in the registry.
///
int Count { get; }
///
/// Number of sessions currently in an active (open) state.
///
int ActiveCount { get; }
///
/// Attempts to add a session to the registry; returns false if session ID already exists.
///
/// Session to add.
/// True if added; false if session ID already exists.
bool TryAdd(GatewaySession session);
///
/// Attempts to retrieve a session by ID; returns false if not found.
///
/// Identifier of the session.
/// The retrieved session, if found.
/// True if found; false otherwise.
bool TryGet(string sessionId, [MaybeNullWhen(false)] out GatewaySession session);
///
/// Attempts to remove a session by ID; returns false if not found.
///
/// Identifier of the session to remove.
/// The removed session, if found.
/// True if removed; false if not found.
bool TryRemove(string sessionId, [MaybeNullWhen(false)] out GatewaySession session);
///
/// Returns a snapshot of all sessions in the registry.
///
/// A read-only collection of all sessions.
IReadOnlyCollection Snapshot();
}