using ZB.MOM.WW.ScadaBridge.Commons.Messages.Streaming; using ZB.MOM.WW.ScadaBridge.Commons.Types.Enums; // AlarmState namespace ZB.MOM.WW.ScadaBridge.CentralUI.Components.Pages.Deployment; /// /// A node in a Debug View composition tree. Attribute (and alarm) /// names are path-qualified canonical names (e.g. Motor1.Compressor.Pump); /// the tree is derived by splitting those names on '.'. A node is either a /// branch (composition member, no payload, has children) or a leaf (one attribute /// or one alarm). Consumed by the generic TreeView<TItem> component. /// public sealed class DebugTreeNode { /// Full canonical path — stable TreeView key. public required string Key { get; init; } /// Display label (the last path segment). public required string Segment { get; init; } /// Child nodes, one per next path segment. Empty on a leaf. public List Children { get; } = new(); // Leaf payloads — exactly one is set on a leaf; both null on a pure branch. /// The attribute value payload when this node is an attribute leaf; null otherwise. public AttributeValueChanged? Attribute { get; init; } /// The alarm state payload when this node is an alarm leaf (computed, native condition, or placeholder); null otherwise. public AlarmStateChanged? Alarm { get; init; } // computed leaf, native condition, or placeholder /// True when this is a branch node grouping native alarm conditions. public bool IsNativeBinding { get; init; } // branch grouping native conditions // Roll-up (set by the builder for branch nodes). /// The worst alarm state rolled up from this node's descendants. public AlarmState WorstState { get; set; } = AlarmState.Normal; /// The count of active alarms rolled up from this node's descendants. public int ActiveCount { get; set; } /// True when any descendant attribute has bad quality. public bool HasBadQuality { get; set; } /// True when this node is a branch (has one or more children). public bool HasChildren => Children.Count > 0; }