namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities; /// /// Per Phase 7 plan decision #14 — persistent runtime state for each scripted alarm. /// Survives process restart so operators don't re-ack and ack history survives for /// GxP / 21 CFR Part 11 compliance. Keyed on ScriptedAlarmId logically (not /// per-generation) because ack state follows the alarm's stable identity across /// generations — a Modified alarm keeps its ack history. /// /// /// /// ActiveState is deliberately NOT persisted — it rederives from the current /// predicate evaluation on startup. Only operator-supplied state (, /// , ) + audit trail persist. /// /// /// is an append-only JSON array of {user, utc, text} /// tuples — one per operator comment. Core.ScriptedAlarms' AlarmConditionState.Comments /// serializes directly into this column. /// /// public sealed class ScriptedAlarmState { /// Logical FK — matches . One row per alarm identity. public required string ScriptedAlarmId { get; set; } /// Enabled/Disabled. Persists across restart per plan decision #14. public required string EnabledState { get; set; } = "Enabled"; /// Unacknowledged / Acknowledged. public required string AckedState { get; set; } = "Unacknowledged"; /// Unconfirmed / Confirmed. public required string ConfirmedState { get; set; } = "Unconfirmed"; /// Unshelved / OneShotShelved / TimedShelved. public required string ShelvingState { get; set; } = "Unshelved"; /// When a TimedShelve expires — null if not shelved or OneShotShelved. public DateTime? ShelvingExpiresUtc { get; set; } /// User who last acknowledged. Null if never acked. public string? LastAckUser { get; set; } /// Operator-supplied ack comment. Null if no comment or never acked. public string? LastAckComment { get; set; } public DateTime? LastAckUtc { get; set; } /// User who last confirmed. public string? LastConfirmUser { get; set; } public string? LastConfirmComment { get; set; } public DateTime? LastConfirmUtc { get; set; } /// JSON array of operator comments, append-only (GxP audit). public string CommentsJson { get; set; } = "[]"; /// Row write timestamp — tracks last state change. public DateTime UpdatedAtUtc { get; set; } }