namespace ZB.MOM.WW.OtOpcUa.Core.Abstractions;
///
/// Driver capability for historical-data reads (OPC UA HistoryRead). Optional —
/// only drivers whose backends carry historian data implement this. Currently:
/// Galaxy (Wonderware Historian via the optional plugin), OPC UA Client (forward
/// to upstream server).
///
public interface IHistoryProvider
{
///
/// Read raw historical samples for a single attribute over a time range.
/// The Core wraps this with continuation-point handling.
///
Task ReadRawAsync(
string fullReference,
DateTime startUtc,
DateTime endUtc,
uint maxValuesPerNode,
CancellationToken cancellationToken);
///
/// Read processed (aggregated) samples — interval-bucketed average / min / max / etc.
/// Optional — drivers that only support raw history can throw .
///
Task ReadProcessedAsync(
string fullReference,
DateTime startUtc,
DateTime endUtc,
TimeSpan interval,
HistoryAggregateType aggregate,
CancellationToken cancellationToken);
}
/// Result of a HistoryRead call.
/// Returned samples in chronological order.
/// Opaque token for the next call when more samples are available; null when complete.
public sealed record HistoryReadResult(
IReadOnlyList Samples,
byte[]? ContinuationPoint);
/// Aggregate function for processed history reads. Mirrors OPC UA Part 13 standard aggregates.
public enum HistoryAggregateType
{
Average,
Minimum,
Maximum,
Total,
Count,
}