namespace OpenNest.Data;
///
/// Drawing sets and their releases on the nest server (/api/sets). Kept apart from
/// so browsing and inserting drawings do not depend on sets.
/// is the only production implementation.
///
public interface IDrawingSetStore
{
/// One bounded page of sets matching the query, without their members.
Task QueryAsync(DrawingSetQuery query, CancellationToken cancellationToken = default);
///
/// The current record, including an archived one, with every member joined to its
/// drawing's current library record; null for an unknown id.
///
Task GetAsync(Guid id, CancellationToken cancellationToken = default);
/// One page of immutable revisions without members, newest first, or null for an unknown id.
Task GetRevisionsAsync(Guid id, int offset = 0,
int limit = DrawingLibraryRules.DefaultRevisionLimit, CancellationToken cancellationToken = default);
/// One revision with its members, or null when the set or revision is unknown.
Task GetRevisionAsync(Guid id, int revision, CancellationToken cancellationToken = default);
/// Sets whose current revision contains the drawing, by name, or null for an unknown drawing.
Task GetSetsContainingAsync(Guid drawingId, int offset = 0,
int limit = DrawingLibraryRules.DefaultRevisionLimit, CancellationToken cancellationToken = default);
/// Stores revision 1 under the caller-allocated record.Id.
Task CreateAsync(DrawingSetRecord record, CancellationToken cancellationToken = default);
/// Saves the next revision when is current.
Task UpdateAsync(Guid id, DrawingSetRecord record, int expectedRevision,
CancellationToken cancellationToken = default);
Task ArchiveAsync(Guid id, int expectedRevision, CancellationToken cancellationToken = default);
Task RestoreAsync(Guid id, int expectedRevision, CancellationToken cancellationToken = default);
/// Records a release whose nests already exist, under the caller-allocated release.Id.
Task PostReleaseAsync(SetReleaseRecord release, CancellationToken cancellationToken = default);
/// One release with its sets and nests, or null for an unknown id.
Task GetReleaseAsync(Guid id, CancellationToken cancellationToken = default);
///
/// One page of releases with their sets and nests, newest first, optionally only those
/// including a set, a nest, or a drawing released on its own.
///
Task QueryReleasesAsync(Guid? setId = null, Guid? nestId = null, Guid? drawingId = null,
int offset = 0, int limit = DrawingLibraryRules.DefaultRevisionLimit, CancellationToken cancellationToken = default);
///
/// Raises when the server cannot record drawings released
/// on their own. A release asks before building its nests, since the record is posted last.
///
Task EnsureDrawingReleasesSupportedAsync(CancellationToken cancellationToken = default);
/// Undoes a release, all or nothing; a refusal raises .
Task UndoReleaseAsync(Guid id, SetReleaseUndoRequest request, CancellationToken cancellationToken = default);
}