namespace ZB.MOM.WW.MxGateway.Server.Configuration; /// /// Controls how the central alarm monitor selects between the MXAccess /// alarm-manager subscription and the subtag-polling fallback, and /// governs the failure-detection thresholds used when switching. /// public sealed class AlarmFallbackOptions { /// /// Selects the operating mode for the alarm-manager ↔ subtag fallback /// mechanism. Accepted values (case-insensitive): /// /// Auto — use the alarm manager; switch to subtag polling /// automatically when failures /// are detected, and probe for failback. /// ForceAlarmManager — always use the alarm manager; /// never fall back. /// ForceSubtag — always use subtag polling; /// never try the alarm manager. /// /// Default is Auto. /// public string Mode { get; init; } = "Auto"; /// /// Number of consecutive alarm-manager failures before the monitor /// switches to subtag-polling fallback. Must be at least 1. Default 3. /// public int ConsecutiveFailureThreshold { get; init; } = 3; /// /// How often (in seconds) the monitor sends a probe to the alarm manager /// while operating in subtag-polling fallback mode, to detect recovery. /// Must be at least 1. Default 30. /// public int FailbackProbeIntervalSeconds { get; init; } = 30; /// /// Number of consecutive successful probes required before the monitor /// considers the alarm manager recovered and switches back. Must be at /// least 1. Default 3. /// public int FailbackStableProbes { get; init; } = 3; /// /// Controls how the monitor discovers the set of objects to poll when /// operating in subtag-polling fallback mode. /// public AlarmDiscoveryOptions Discovery { get; init; } = new(); /// /// Configures the subtag names the monitor reads when polling alarm state /// in subtag-fallback mode. /// public AlarmSubtagNameOptions Subtags { get; init; } = new(); } /// /// Governs how the alarm monitor discovers objects to include in subtag-polling /// fallback mode. Either the Galaxy Repository query (when /// is true) or an explicit /// list must be supplied when /// MxGateway:Alarms:Fallback:Mode is ForceSubtag. /// public sealed class AlarmDiscoveryOptions { /// /// When true the monitor queries the Galaxy Repository SQL database /// to enumerate alarm objects for the configured area. Default true. /// public bool UseGalaxyRepository { get; init; } = true; /// /// Galaxy area to scope the Repository query to. When empty the monitor /// falls back to . Ignored when /// is false. /// public string Area { get; init; } = string.Empty; /// /// Explicit list of MXAccess attribute paths to include in subtag polling, /// supplementing (or replacing, when is /// false) the Repository-derived list. Default empty. /// public string[] IncludeAttributes { get; init; } = Array.Empty(); /// /// Attribute paths to exclude from the Repository-derived poll list. /// Ignored when is false. /// Default empty. /// public string[] ExcludeAttributes { get; init; } = Array.Empty(); } /// /// Configures the subtag names read by the alarm monitor when it is operating /// in subtag-polling fallback mode. Names are matched against MXAccess item /// handles; validation against the live MXAccess attribute list occurs at /// runtime, not at startup. /// public sealed class AlarmSubtagNameOptions { /// /// Subtag name for the active-alarm flag. Default active. /// public string Active { get; init; } = "active"; /// /// Subtag name for the acknowledged flag. Default acked. /// public string Acked { get; init; } = "acked"; /// /// Optional subtag name for the acknowledgement comment field. /// When empty the feature is disabled. Verified against MXAccess at /// runtime before use. Default empty. /// public string AckComment { get; init; } = string.Empty; /// /// Subtag name for the alarm priority. Default priority. /// public string Priority { get; init; } = "priority"; }