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, in DV-4, 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; } public List Children { get; } = new(); // Leaf payloads — exactly one is set on a leaf; both null on a pure branch. public AttributeValueChanged? Attribute { get; init; } public AlarmStateChanged? Alarm { get; init; } // computed leaf, native condition, or placeholder (DV-4) public bool IsNativeBinding { get; init; } // branch grouping native conditions (DV-4) // Roll-up (set by the builder for branch nodes). public AlarmState WorstState { get; set; } = AlarmState.Normal; public int ActiveCount { get; set; } public bool HasBadQuality { get; set; } public bool HasChildren => Children.Count > 0; }