namespace ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol;
///
/// Per-tag outcome of a batch subscribe. A failed row is a genuine per-tag fault
/// (bad node id, unresolvable path) and never aborts the batch — mirroring the
/// MxAccess Gateway's SubscribeResult and OPC UA's per-monitored-item create
/// status. A batch that fails at connection level throws instead, so the
/// DataConnectionActor can drive the reconnect state machine.
///
/// The requested tag path.
/// Whether the tag was subscribed.
/// Adapter subscription handle when ; otherwise null.
/// Per-tag failure reason when not successful.
public record TagSubscribeResult(string TagPath, bool Success, string? SubscriptionId, string? ErrorMessage);
///
/// Optional capability for an implementation whose
/// protocol can subscribe/unsubscribe MANY tags in one round trip, and whose
/// /
/// are TRUE bulk service calls rather than a loop over the single-tag methods.
/// Mirrors the /
/// capability-interface pattern; consumed by the DataConnectionActor only.
///
///
/// Implementing this interface is the adapter's assertion that batching is genuinely
/// cheaper than N single calls: the actor then subscribes, unsubscribes and seed-reads
/// in bounded chunks instead of per tag. An adapter that does NOT implement it keeps
/// the historical per-tag behaviour, so the capability is purely additive.
///
///
public interface IBatchSubscribableConnection
{
///
/// Subscribes every tag in in as few protocol round
/// trips as the adapter allows, returning one per
/// requested tag (in any order — callers key by ).
/// All tags share ONE ; the callback already carries the
/// tag path, so per-tag delegates would carry nothing extra.
///
/// The tag paths to subscribe.
/// Callback invoked for every value change on any of the tags.
/// Cancellation token.
/// One result row per requested tag path.
///
/// A connection-level fault (adapter not connected / transport down) is thrown so the
/// caller classifies it as a connection failure; per-tag faults are result rows.
///
Task> SubscribeBatchAsync(
IReadOnlyList tagPaths, SubscriptionCallback callback, CancellationToken cancellationToken = default);
///
/// Releases every supplied subscription id in as few protocol round trips as the
/// adapter allows. Unknown/stale ids are ignored, mirroring
/// .
///
/// Subscription ids previously returned by a subscribe call.
/// Cancellation token.
/// A task that represents the asynchronous operation.
Task UnsubscribeBatchAsync(IReadOnlyList subscriptionIds, CancellationToken cancellationToken = default);
}