namespace ZB.MOM.WW.OtOpcUa.Commons.Browsing;
///
/// A live, one-level-at-a-time browse over a remote address space. Owned by the
/// AdminUI BrowseSessionRegistry; disposed by the registry's TTL reaper or
/// the picker body on close.
///
public interface IBrowseSession : IAsyncDisposable
{
/// Opaque token identifying this session in the registry.
Guid Token { get; }
/// Wall-clock time of the most recent successful call. Refreshed on
/// , , and
/// ; used by the reaper for idle eviction.
DateTime LastUsedUtc { get; }
/// Returns the top-level browse nodes.
/// Cancellation token for the operation.
/// The top-level browse nodes.
Task> RootAsync(CancellationToken cancellationToken);
/// Returns the direct children of the node identified by
/// .
/// The node whose direct children are returned.
/// Cancellation token for the operation.
/// The direct children of the node.
Task> ExpandAsync(string nodeId, CancellationToken cancellationToken);
/// Returns the attributes of the node identified by .
/// Empty for drivers whose tree is uniform (OPC UA Client). Galaxy uses this to populate
/// the attribute side-panel after the user selects an object.
/// The node whose attributes are returned.
/// Cancellation token for the operation.
/// The attributes of the node.
Task> AttributesAsync(string nodeId, CancellationToken cancellationToken);
}
///
/// An whose protocol offers an explicit, operator-triggered
/// re-announce action: a request that the remote peer republish its self-description so the
/// observation window can fill without waiting for the next natural announcement. Implemented
/// today only by the MQTT/Sparkplug browser, whose tree is built from observed NBIRTH/DBIRTH
/// certificates.
///
///
///
/// This is the only interface in the browse contract that causes an outbound message.
/// Every other browse member is strictly read-only, and for the MQTT browser that read-only
/// property is load-bearing: a picker opened by an operator runs against a live production
/// broker. It is a separate interface, rather than an optional member on
/// , precisely so "does this session write?" stays a type
/// question a caller cannot forget to ask.
///
///
/// Callers must authorize before invoking it. The AdminUI routes it through
/// BrowserSessionService.RequestRebirthAsync, which enforces the same
/// DriverOperator policy that gates the picker's Browse affordance — an implementation
/// cannot check that itself, since it holds no user identity.
///
///
public interface IRebirthCapableBrowseSession : IBrowseSession
{
///
/// Whether this particular session can actually re-announce — the runtime half of the
/// type question, and the one a UI must ask before offering the affordance.
///
///
/// One session class may serve several protocol shapes: the MQTT browser opens the same session
/// type for Plain and for Sparkplug B, and a Plain MQTT window publishes nothing, ever —
/// there is no plain-MQTT re-announce to offer. Implementing the interface therefore means "this
/// session type may re-announce"; this property means "this instance will". A UI gating on the
/// type alone would draw a button that can only ever throw.
///
/// This is not an authorization signal — see the interface remarks. False here hides
/// the affordance; the caller still authorizes before invoking
/// , and the implementation still refuses a call it cannot
/// serve.
///
///
bool RebirthAvailable { get; }
///
/// Asks the addressed remote peer(s) to re-announce themselves.
///
///
/// The protocol-specific target. For Sparkplug: a browse NodeId from this session's own
/// tree (group, edge node, device or metric — resolved up to the owning edge node), or a bare
/// {group}/{edgeNode} pair for a node that has not been observed yet.
///
/// Cancellation token for the operation.
/// The number of request messages published.
/// is empty or unusable.
///
/// The scope resolves to no target, or to more targets than the implementation will fan out to
/// in one action. Nothing is published in either case.
///
/// This session's mode has no re-announce action.
Task RequestRebirthAsync(string scope, CancellationToken cancellationToken);
}