namespace ZB.MOM.WW.MxGateway.Server.Dashboard; /// /// Snapshot of the Galaxy Repository (ZB) browse state surfaced on the dashboard. /// Built by from the shared-library Galaxy /// hierarchy cache on each dashboard snapshot; the projector memoizes only the O(N) /// on the cache sequence while copying the volatile /// status/timestamp fields fresh, so the dashboard never blocks on SQL. /// public sealed record DashboardGalaxySummary( DashboardGalaxyStatus Status, DateTimeOffset? LastQueriedAt, DateTimeOffset? LastSuccessAt, DateTimeOffset? LastDeployTime, string? LastError, int ObjectCount, int AreaCount, int AttributeCount, int HistorizedAttributeCount, int AlarmAttributeCount, IReadOnlyList TopTemplates, IReadOnlyList ObjectCategories) { /// Gets the unknown Galaxy status placeholder. public static DashboardGalaxySummary Unknown { get; } = new( DashboardGalaxyStatus.Unknown, LastQueriedAt: null, LastSuccessAt: null, LastDeployTime: null, LastError: null, ObjectCount: 0, AreaCount: 0, AttributeCount: 0, HistorizedAttributeCount: 0, AlarmAttributeCount: 0, TopTemplates: Array.Empty(), ObjectCategories: Array.Empty()); } public enum DashboardGalaxyStatus { Unknown = 0, Healthy = 1, Stale = 2, Unavailable = 3, } public sealed record DashboardGalaxyTemplateUsage(string TemplateName, int InstanceCount); public sealed record DashboardGalaxyCategoryCount(int CategoryId, string CategoryName, int ObjectCount); /// /// The O(N)-computed template-usage and category breakdown of a Galaxy hierarchy cache entry — /// the only part of that changes with the cache sequence /// and is therefore safe to memoize on it. /// public sealed record GalaxyObjectBreakdown( IReadOnlyList TopTemplates, IReadOnlyList ObjectCategories) { /// Gets the empty breakdown (no templates, no categories). public static GalaxyObjectBreakdown Empty { get; } = new( Array.Empty(), Array.Empty()); }