using ZB.MOM.WW.HistorianGateway.Contracts.Grpc;
namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Gateway;
///
/// Abstraction over the HistorianGateway gRPC client surface consumed by the OtOpcUa historian
/// backend driver. Proto-typed (the wire contract lives in
/// ZB.MOM.WW.HistorianGateway.Contracts.Grpc); the concrete adapter wrapping
/// HistorianGatewayClient is supplied by a later task. The seam exists so the driver and
/// its tests can depend on a fake without a live gateway.
///
public interface IHistorianGatewayClient : IAsyncDisposable
{
/// Streams raw historian samples for a tag over a time window.
IAsyncEnumerable ReadRawAsync(
string tag,
DateTime startUtc,
DateTime endUtc,
int maxValues,
CancellationToken ct);
/// Streams aggregate samples for a tag using the given retrieval mode and interval.
IAsyncEnumerable ReadAggregateAsync(
string tag,
DateTime startUtc,
DateTime endUtc,
RetrievalMode mode,
TimeSpan interval,
CancellationToken ct);
/// Reads the samples nearest to each of the requested timestamps (unary).
Task> ReadAtTimeAsync(
string tag,
IReadOnlyList timestampsUtc,
CancellationToken ct);
/// Streams historian events over a window, optionally filtered to a single source name.
IAsyncEnumerable ReadEventsAsync(
string? sourceName,
DateTime startUtc,
DateTime endUtc,
int maxEvents,
CancellationToken ct);
/// Writes live values for a tag through the gateway's SQL live-write path.
Task WriteLiveValuesAsync(
string tag,
IReadOnlyList values,
CancellationToken ct);
/// Sends a single historian event.
Task SendEventAsync(HistorianEvent evt, CancellationToken ct);
/// Ensures the supplied tag definitions exist (create-or-update).
Task EnsureTagsAsync(
IReadOnlyList definitions,
CancellationToken ct);
/// Probes gateway/historian reachability.
Task ProbeAsync(CancellationToken ct);
/// Reads the gateway's current historian connection status.
Task GetConnectionStatusAsync(CancellationToken ct);
}