namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Streaming builder API a driver uses to register OPC UA nodes during discovery.
/// Core owns the tree; driver streams AddFolder / AddVariable calls
/// as it discovers nodes — no buffering of the whole tree.
///
///
/// Per docs/v2/plan.md decision #52 — drivers register nodes via this builder
/// rather than returning a tree object. Supports incremental / large address spaces
/// without forcing the driver to buffer the whole tree.
///
public interface IAddressSpaceBuilder
{
///
/// Add a folder node. Returns a child builder scoped to inside this folder, so subsequent
/// calls on the child place nodes under it.
///
/// OPC UA browse name (the segment of the path under the parent).
/// Human-readable display name. May equal .
IAddressSpaceBuilder Folder(string browseName, string displayName);
///
/// Add a variable node corresponding to a tag. Driver-side full reference + data-type
/// metadata come from the DTO.
///
/// OPC UA browse name (the segment of the path under the parent folder).
/// Human-readable display name. May equal .
/// Driver-side metadata for the variable.
IVariableHandle Variable(string browseName, string displayName, DriverAttributeInfo attributeInfo);
///
/// Add a property to the current node (folder or variable). Properties are static metadata
/// read once at build time (e.g. OPC 40010 Identification fields per the schemas-repo
/// _base equipment-class template).
///
void AddProperty(string browseName, DriverDataType dataType, object? value);
}
/// Opaque handle for a registered variable. Used by Core for subscription routing.
public interface IVariableHandle
{
/// Driver-side full reference for read/write addressing.
string FullReference { get; }
///
/// Annotate this variable with an OPC UA AlarmConditionState. Drivers with
/// = true call this during discovery so the
/// concrete address-space builder can materialize a sibling condition node. The returned
/// sink receives lifecycle transitions raised through
/// — the generic node manager wires the subscription; the concrete builder decides how
/// to surface the state (e.g. OPC UA AlarmConditionState.Activate,
/// Acknowledge, Deactivate).
///
IAlarmConditionSink MarkAsAlarmCondition(AlarmConditionInfo info);
}
///
/// Metadata used to materialize an OPC UA AlarmConditionState sibling for a variable.
/// Populated by the driver's discovery step; concrete builders decide how to surface it.
///
/// Human-readable alarm name used for the SourceName event field.
/// Severity at address-space build time; updates arrive via .
/// Initial description; updates arrive via .
public sealed record AlarmConditionInfo(
string SourceName,
AlarmSeverity InitialSeverity,
string? InitialDescription);
///
/// Sink a concrete address-space builder returns from .
/// The generic node manager routes per-alarm payloads here —
/// the sink translates the transition into an OPC UA condition state change or whatever the
/// concrete builder's backing address space supports.
///
public interface IAlarmConditionSink
{
/// Push an alarm transition (Active / Acknowledged / Inactive) for this condition.
void OnTransition(AlarmEventArgs args);
}