using System;
namespace MxGateway.Worker.MxAccess;
///
/// Library-agnostic alarm-state enum. Mirrors the four STATE
/// values returned by AVEVA's WNWRAPCONSUMERLib XML payload —
/// UNACK_ALM, ACK_ALM, UNACK_RTN, ACK_RTN.
/// Decoupling the consumer from any specific COM library keeps the
/// proto-build path testable without an AVEVA install.
///
public enum MxAlarmStateKind
{
Unspecified = 0,
UnackAlm = 1,
AckAlm = 2,
UnackRtn = 3,
AckRtn = 4,
}
///
/// Single alarm record as emitted by the wnwrapConsumer XML stream.
/// Field names match the captured XML schema (see
/// docs/AlarmClientDiscovery.md "Option A — captured" section).
///
public sealed class MxAlarmSnapshotRecord
{
public Guid AlarmGuid { get; set; }
public DateTime TransitionTimestampUtc { get; set; }
public string ProviderNode { get; set; } = string.Empty;
public string ProviderName { get; set; } = string.Empty;
public string Group { get; set; } = string.Empty;
public string TagName { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string Limit { get; set; } = string.Empty;
public int Priority { get; set; }
public MxAlarmStateKind State { get; set; }
public string OperatorNode { get; set; } = string.Empty;
public string OperatorName { get; set; } = string.Empty;
public string AlarmComment { get; set; } = string.Empty;
}
///
/// One transition emitted by the consumer's snapshot diff. Pairs the
/// latest record with its previous state so the proto layer can decide
/// whether the transition is a Raise / Acknowledge / Clear.
///
public sealed class MxAlarmTransitionEvent : EventArgs
{
public MxAlarmSnapshotRecord Record { get; set; } = new MxAlarmSnapshotRecord();
///
/// The state on the consumer's previous polled snapshot, or
/// when this is the
/// first time the GUID has been observed.
///
public MxAlarmStateKind PreviousState { get; set; }
}