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

namespace Tornado3_2026Election.Services;

public interface IDataRefreshGate
{
    bool IsRefreshing { get; }

    Task WaitForRefreshAsync(CancellationToken cancellationToken);

    ElectionDataSnapshot GetCurrentSnapshot();

    bool ValidateForFormat(FormatTemplateDefinition template, out string errorMessage);

    bool ValidateSnapshotForFormat(FormatTemplateDefinition template, ElectionDataSnapshot snapshot, out string errorMessage);

    Task<IReadOnlyList<ScheduleRegionTarget>> ResolveScheduleRegionTargetsAsync(
        ChannelScheduleItem item,
        FormatTemplateDefinition template,
        BroadcastStationProfile station,
        CancellationToken cancellationToken);

    Task<ElectionDataSnapshot> GetScheduleSnapshotAsync(
        ChannelScheduleItem item,
        FormatTemplateDefinition template,
        ScheduleRegionTarget target,
        CancellationToken cancellationToken);

    Task<ElectionDataSnapshot> GetAggregateScheduleSnapshotAsync(
        ChannelScheduleItem item,
        FormatTemplateDefinition template,
        BroadcastStationProfile station,
        IReadOnlyList<ScheduleRegionTarget> regionTargets,
        CancellationToken cancellationToken);
}
