namespace StellaOps.Feedser.Core.Jobs;

public interface IJobCoordinator
{
    Task<JobTriggerResult> TriggerAsync(string kind, IReadOnlyDictionary<string, object?>? parameters, string trigger, CancellationToken cancellationToken);

    Task<IReadOnlyList<JobDefinition>> GetDefinitionsAsync(CancellationToken cancellationToken);

    Task<IReadOnlyList<JobRunSnapshot>> GetRecentRunsAsync(string? kind, int limit, CancellationToken cancellationToken);

    Task<IReadOnlyList<JobRunSnapshot>> GetActiveRunsAsync(CancellationToken cancellationToken);

    Task<JobRunSnapshot?> GetRunAsync(Guid runId, CancellationToken cancellationToken);

    Task<JobRunSnapshot?> GetLastRunAsync(string kind, CancellationToken cancellationToken);

    Task<IReadOnlyDictionary<string, JobRunSnapshot>> GetLastRunsAsync(IEnumerable<string> kinds, CancellationToken cancellationToken);
}
