// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

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

namespace FloraMultiPlatformFrontend.Data.Repositories.Interfaces;

/// <summary>
/// Provides active operation intervals (start/end) for given tag IDs within a time window.
/// </summary>
public interface ITimelineIntervalProvider
{
    /// <summary>
    /// Get operation intervals (start/end) for each tag ID within [start, end].
    /// </summary>
    /// <param name="tagIds">Tag IDs to query</param>
    /// <param name="start">Inclusive window start (UTC recommended)</param>
    /// <param name="end">Inclusive window end (UTC recommended)</param>
    /// <param name="machineCode">Machine code (e.g. S1349)</param>
    /// <param name="cancellationToken">Cancellation token</param>
    /// <returns>
    /// Dictionary keyed by TagId, with a list of (start, end) tuples representing active periods.
    /// Empty dictionary when no results.
    /// </returns>
    Task<Dictionary<int, List<(DateTime start, DateTime end)>>> GetIntervalsAsync(
        IEnumerable<int> tagIds,
        DateTime start,
        DateTime end,
        string machineCode,
        bool activeState = true,
        CancellationToken cancellationToken = default
    );
}
