using ZB.MOM.WW.GalaxyRepository;
namespace ZB.MOM.WW.MxGateway.Server.Dashboard;
///
/// In-process facade over for the dashboard's
/// BrowsePage. Provides one-level-at-a-time browse without going through the
/// gRPC stack. Backed by the same shared the
/// gRPC service uses, so dashboard and external clients render identical results.
///
public interface IDashboardBrowseService
{
/// Returns root browse nodes (objects with no parent).
/// Filter arguments forwarded to the projector.
/// The root-level browse nodes and the cache sequence they were projected from.
BrowseLevelResult GetRoots(BrowseFilterArgs filter);
/// Returns the direct children of the given parent gobject id.
/// The Galaxy gobject id of the parent to expand.
/// Filter arguments forwarded to the projector.
/// The child browse nodes for the requested parent and the cache sequence they were projected from.
BrowseLevelResult GetChildren(int parentGobjectId, BrowseFilterArgs filter);
/// Current Galaxy cache sequence. Bumps after each successful refresh.
ulong CurrentCacheSequence { get; }
}
/// Filter arguments forwarded into the projector.
/// Optional tag-name glob filter (case-insensitive).
/// When true, only return objects with at least one alarm-bearing attribute.
/// When true, only return objects with at least one historized attribute.
public sealed record BrowseFilterArgs(
string? TagNameGlob = null,
bool AlarmBearingOnly = false,
bool HistorizedOnly = false);
/// One level of browse data plus the cache sequence it was projected from.
/// The direct-child nodes for the requested parent (or roots when no parent given).
/// Total matching sibling count, post-filter.
/// The cache entry sequence this result was projected from.
/// Friendly error string if the projection failed; null on success.
public sealed record BrowseLevelResult(
IReadOnlyList Nodes,
int TotalCount,
ulong CacheSequence,
string? Error = null);