using System.Threading.Channels;
using ZB.MOM.WW.MxGateway.Contracts.Proto;

namespace ZB.MOM.WW.MxGateway.Server.Sessions;

/// <summary>
///     A registration lease into a <see cref="SessionEventDistributor"/>. Exposes the
///     subscriber's own <see cref="ChannelReader{T}"/> of fanned events. Disposing the
///     lease unregisters the subscriber and completes its channel without disturbing the
///     pump or other subscribers.
/// </summary>
public interface IEventSubscriberLease : IDisposable
{
    /// <summary>
    /// Gets the reader for this subscriber's fanned event channel.
    /// </summary>
    ChannelReader<MxEvent> Reader { get; }
}
