namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Models;

/// <summary>
///     Event data for an alarm or condition notification from the OPC UA server.
/// </summary>
public sealed class AlarmEventArgs : EventArgs
{
    public AlarmEventArgs(
        string sourceName,
        string conditionName,
        ushort severity,
        string message,
        bool retain,
        bool activeState,
        bool ackedState,
        DateTime time,
        byte[]? eventId = null,
        string? conditionNodeId = null)
    {
        SourceName = sourceName;
        ConditionName = conditionName;
        Severity = severity;
        Message = message;
        Retain = retain;
        ActiveState = activeState;
        AckedState = ackedState;
        Time = time;
        EventId = eventId;
        ConditionNodeId = conditionNodeId;
    }

    /// <summary>The name of the source object that raised the alarm.</summary>
    public string SourceName { get; }

    /// <summary>The condition type name.</summary>
    public string ConditionName { get; }

    /// <summary>The alarm severity (0-1000).</summary>
    public ushort Severity { get; }

    /// <summary>Human-readable alarm message.</summary>
    public string Message { get; }

    /// <summary>Whether the alarm should be retained in the display.</summary>
    public bool Retain { get; }

    /// <summary>Whether the alarm condition is currently active.</summary>
    public bool ActiveState { get; }

    /// <summary>Whether the alarm has been acknowledged.</summary>
    public bool AckedState { get; }

    /// <summary>The time the event occurred.</summary>
    public DateTime Time { get; }

    /// <summary>The EventId used for alarm acknowledgment.</summary>
    public byte[]? EventId { get; }

    /// <summary>The NodeId of the condition instance (SourceNode), used for acknowledgment.</summary>
    public string? ConditionNodeId { get; }
}