using ZB.MOM.WW.Audit;

namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Audit;

/// <summary>
/// Akka message sent to the central <c>AuditLogIngestActor</c> (site-sync
/// pipeline) carrying a batch of <see cref="AuditEvent"/> rows
/// decoded by the <c>SiteStreamGrpcServer</c> from a site's
/// <c>IngestAuditEvents</c> gRPC RPC. The actor stamps
/// <see cref="AuditEvent.IngestedAtUtc"/> and writes the rows idempotently to
/// the central <c>AuditLog</c> table.
/// </summary>
/// <remarks>
/// Lives in <c>ZB.MOM.WW.ScadaBridge.Commons</c> rather than <c>ZB.MOM.WW.ScadaBridge.AuditLog</c>
/// because the gRPC server in <c>ZB.MOM.WW.ScadaBridge.Communication</c> needs to construct
/// it, and <c>ZB.MOM.WW.ScadaBridge.AuditLog</c> already references
/// <c>ZB.MOM.WW.ScadaBridge.Communication</c> (the proto DTOs live there). Putting the
/// message in Commons avoids a project-reference cycle.
/// </remarks>
public sealed record IngestAuditEventsCommand(IReadOnlyList<AuditEvent> Events);
