namespace ZB.MOM.WW.ScadaBridge.AuditLog.Central;

/// <summary>
/// Symmetric failure twin of <see cref="AuditLogPurgedEvent"/>. Published on the
/// actor-system EventStream by <see cref="AuditLogPurgeActor"/> whenever a purge
/// step throws — a partition switch-out, a per-channel override DELETE, or the
/// boundary enumeration that precedes them. A silently failing retention job is a
/// health-surface condition, not just a log line, so this event lets the central
/// health collector + ops dashboards observe purge failures without coupling to
/// the actor (arch-review 04, S2).
/// </summary>
/// <param name="MonthBoundary">
/// The pf_AuditLog_Month lower-bound boundary whose switch-out failed. When the
/// failure occurs BEFORE any specific boundary is selected — i.e. the pre-purge
/// boundary enumeration threw — this is <see cref="System.DateTime.MinValue"/> as a
/// sentinel for "enumeration phase, no boundary in hand".
/// </param>
/// <param name="Error">
/// The failure's message (<see cref="System.Exception.Message"/>). The full
/// exception is logged at Error on the actor's logger; this carries the short form
/// for surfacing on health/ops without leaking a full stack trace onto the stream.
/// </param>
/// <param name="ElapsedMilliseconds">
/// Wall-clock time spent on the failed step before it threw, in milliseconds.
/// </param>
public sealed record AuditLogPurgeFailedEvent(
    DateTime MonthBoundary,
    string Error,
    long ElapsedMilliseconds);
