using ZB.MOM.WW.OtOpcUa.Core.Abstractions;

namespace ZB.MOM.WW.OtOpcUa.Core.AlarmHistorian;

/// <summary>
///     The event shape the historian sink consumes — source-agnostic across scripted
///     alarms + Galaxy-native + AB CIP ALMD + any future IAlarmSource (sink scope = all
///     alarm sources, not just scripted). A per-alarm
///     <c>HistorizeToAveva</c> toggle on the producer side gates which events flow.
/// </summary>
/// <param name="AlarmId">Stable condition identity.</param>
/// <param name="EquipmentPath">UNS path of the Equipment node the alarm hangs under. Doubles as the "SourceNode" in Historian's alarm schema.</param>
/// <param name="AlarmName">Human-readable alarm name.</param>
/// <param name="AlarmTypeName">Concrete Part 9 subtype — "LimitAlarm" / "DiscreteAlarm" / "OffNormalAlarm" / "AlarmCondition". Used as the Historian "AlarmType" column.</param>
/// <param name="Severity">Mapped to Historian's numeric priority on the sink side.</param>
/// <param name="EventKind">
///     Which state transition this event represents — "Activated" / "Cleared" /
///     "Acknowledged" / "Confirmed" / "Shelved" / "Unshelved" / "Disabled" / "Enabled" /
///     "CommentAdded". Free-form string because different alarm sources use different
///     vocabularies; the Wonderware historian sidecar (<c>WonderwareHistorianClient</c>)
///     maps to the historian's enum on the wire.
/// </param>
/// <param name="Message">Fully-rendered message text — template tokens already resolved upstream.</param>
/// <param name="User">Operator who triggered the transition. "system" for engine-driven events (shelving expiry, predicate change).</param>
/// <param name="Comment">Operator-supplied free-form text, if any.</param>
/// <param name="TimestampUtc">When the transition occurred.</param>
public sealed record AlarmHistorianEvent(
    string AlarmId,
    string EquipmentPath,
    string AlarmName,
    string AlarmTypeName,
    AlarmSeverity Severity,
    string EventKind,
    string Message,
    string User,
    string? Comment,
    DateTime TimestampUtc);
