namespace ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol;
///
/// Optional capability for an implementation
/// that supports browsing the server's address space. Consumed only by
/// management/UI flows (e.g. the OPC UA tag picker on the instance config
/// page) — never by Instance Actors on the hot path.
///
public interface IBrowsableDataConnection
{
///
/// Returns the immediate children of , or
/// the server's root-level nodes when null.
///
/// Node id whose children to browse, or null for the server root (OPC UA ObjectsFolder).
/// Cancellation token; on cancellation the implementation should throw .
Task BrowseChildrenAsync(
string? parentNodeId,
CancellationToken cancellationToken = default);
}
/// Child nodes returned by the server in browse order.
/// True when the server reported more children than the per-call cap; remaining children must be discovered via manual entry.
public record BrowseChildrenResult(
IReadOnlyList Children,
bool Truncated);
/// Server-issued node identifier (e.g. "ns=2;s=Devices.Pump1.Speed").
/// Human-readable display name from the server's DisplayName attribute.
/// Classifies the node for UI purposes (Variable rows are selectable; Object rows are navigable).
/// Hint so the UI can render an expand chevron without a second roundtrip.
public record BrowseNode(
string NodeId,
string DisplayName,
BrowseNodeClass NodeClass,
bool HasChildren);
public enum BrowseNodeClass { Object, Variable, Method, Other }
///
/// Thrown by when
/// the underlying session is not currently connected. Translated to
/// BrowseFailureKind.ConnectionNotConnected by the site-side handler.
///
public sealed class ConnectionNotConnectedException : InvalidOperationException
{
public ConnectionNotConnectedException(string message) : base(message) { }
}