using Titano.Protocol;
using Titano.Protocol.Client;
namespace Titano.App.Editor;
///
/// The server calls the editor of a server sequence makes (BRIEF ยง14.3): the sequence and its settings with their
/// version, the analysis report, jobs and events. Failures are s (404 gone, 409 settings
/// changed meanwhile) or network exceptions. The editor disposes its connection when it closes.
///
public interface IRemoteSequenceApi : IDisposable
{
Task GetSequenceAsync(Guid id, CancellationToken cancellationToken);
/// The settings JSON and its version, the frames and the renders.
Task GetManifestAsync(Guid id, CancellationToken cancellationToken);
/// A 409 means the settings version moved on the server.
Task UpdateSequenceAsync(Guid id, UpdateSequenceRequest request, CancellationToken cancellationToken);
/// The full deep-analysis report (analysis.json); null when the sequence was never deep-analysed.
Task GetAnalysisReportAsync(Guid id, CancellationToken cancellationToken);
Task CreateJobAsync(CreateJobRequest request, CancellationToken cancellationToken);
Task GetJobAsync(Guid id, CancellationToken cancellationToken);
/// Every analysis and render job waiting, running or paused on the server (all pages).
Task> ListActiveJobsAsync(CancellationToken cancellationToken);
/// Cancels a waiting or running job; returns it as the server now has it.
Task CancelJobAsync(Guid id, CancellationToken cancellationToken);
/// Queues a failed or cancelled job again from its checkpoint; returns it as the server now has it.
Task RetryJobAsync(Guid id, CancellationToken cancellationToken);
/// Moves a waiting job up or down the queue (: background, normal or user).
Task SetJobPriorityAsync(Guid id, string priority, CancellationToken cancellationToken);
/// Server events until cancelled or the socket closes.
IAsyncEnumerable EventsAsync(CancellationToken cancellationToken);
}