using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace ZB.MOM.WW.OtOpcUa.Driver.Galaxy.Host.Backend.Historian
{
    /// <summary>
    ///     OPC-UA-free surface for the Wonderware Historian subsystem inside Galaxy.Host.
    ///     Implementations read via the aahClient* SDK; the Proxy side maps returned samples
    ///     to OPC UA <c>DataValue</c>.
    /// </summary>
    public interface IHistorianDataSource : IDisposable
    {
        Task<List<HistorianSample>> ReadRawAsync(
            string tagName, DateTime startTime, DateTime endTime, int maxValues,
            CancellationToken ct = default);

        Task<List<HistorianAggregateSample>> ReadAggregateAsync(
            string tagName, DateTime startTime, DateTime endTime,
            double intervalMs, string aggregateColumn,
            CancellationToken ct = default);

        Task<List<HistorianSample>> ReadAtTimeAsync(
            string tagName, DateTime[] timestamps,
            CancellationToken ct = default);

        Task<List<HistorianEventDto>> ReadEventsAsync(
            string? sourceName, DateTime startTime, DateTime endTime, int maxEvents,
            CancellationToken ct = default);

        HistorianHealthSnapshot GetHealthSnapshot();
    }
}
