using Microsoft.Extensions.Logging.Abstractions;
using ZB.MOM.WW.MxGateway.Server.Configuration;
using ZB.MOM.WW.MxGateway.Server.Grpc;
namespace ZB.MOM.WW.MxGateway.Server.Sessions;
///
/// Dependencies a needs to construct and own its
/// . Bundled so the session constructor stays a
/// single optional parameter rather than four, and so unit tests that build a session
/// directly get a working distributor from without wiring DI.
///
///
/// Maps worker IPC WorkerEvent frames to public MxEvents. The distributor
/// pump applies this once per event in worker order, mirroring the mapping
/// EventStreamService.ProduceEventsAsync used before Task 4.
///
///
/// Supplies the distributor's per-subscriber queue capacity and replay ring-buffer
/// bounds (,
/// ,
/// ).
///
/// Logger for the distributor pump lifecycle.
/// Clock used to timestamp and age-evict replay entries.
public sealed record SessionEventStreaming(
MxAccessGrpcMapper Mapper,
EventOptions EventOptions,
ILogger DistributorLogger,
TimeProvider TimeProvider)
{
///
/// Defaults used when a session is constructed without explicit streaming
/// dependencies (unit tests). Uses a fresh mapper, default event options, a no-op
/// logger, and the system clock.
///
public static SessionEventStreaming Default { get; } = new(
new MxAccessGrpcMapper(),
new EventOptions(),
NullLogger.Instance,
TimeProvider.System);
}