using ZB.MOM.WW.OtOpcUa.Commons.Browsing; namespace ZB.MOM.WW.OtOpcUa.AdminUI.Browsing; /// /// Outcome of . On success /// is and is the /// registry handle; on failure carries a human-readable /// diagnostic for the UI's error chip. /// /// True iff the browse session was opened and registered. /// Failure diagnostic, or on success. /// Registry handle on success; on failure. public sealed record BrowseOpenResult(bool Ok, string? Message, Guid Token); /// /// Scoped Razor-page facade over the in-process browse-session machinery. Owns /// driver-type dispatch on open and per-call timeout enforcement on expand/attributes. /// public interface IBrowserSessionService { /// Opens a session against the named driver type using the given JSON config. /// Never throws — all errors are surfaced via . /// The driver type to open a browse session against. /// The driver configuration as JSON. /// Cancellation token for the operation. /// The result of opening the session, including the registry token on success. Task OpenAsync(string driverType, string configJson, CancellationToken ct); /// Returns the root nodes of an open session. Throws /// if the token is unknown. /// Registry handle for the open browse session. /// Cancellation token for the operation. /// The top-level browse nodes. Task> RootAsync(Guid token, CancellationToken ct); /// Returns the direct children of in an open session. /// Throws if the token is unknown. /// Registry handle for the open browse session. /// The node whose direct children are returned. /// Cancellation token for the operation. /// The direct children of the node. Task> ExpandAsync(Guid token, string nodeId, CancellationToken ct); /// Returns the attributes of in an open session. Throws /// if the token is unknown. /// Registry handle for the open browse session. /// The node whose attributes are returned. /// Cancellation token for the operation. /// The attributes of the node. Task> AttributesAsync(Guid token, string nodeId, CancellationToken ct); /// Removes the session from the registry and disposes it. No-op for unknown tokens. /// Registry handle for the browse session to close. /// A task that represents the asynchronous operation. Task CloseAsync(Guid token); } /// /// Raised by the service layer when a caller references a token that is not /// (or no longer) in the registry — typically because the reaper evicted it /// between calls. /// public sealed class BrowseSessionNotFoundException(Guid token) : InvalidOperationException($"Browse session {token} not found (may have been reaped).");