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(Guid setId, SetReleaseRecord release,
CancellationToken cancellationToken = default);
/// One page of the set's releases with their nests, newest first, or null for an unknown set.
Task GetReleasesAsync(Guid setId, int offset = 0,
int limit = DrawingLibraryRules.DefaultRevisionLimit, CancellationToken cancellationToken = default);
/// The release a nest came from, or null when it came from none (or is unknown).
Task GetReleaseForNestAsync(Guid nestId, CancellationToken cancellationToken = default);
}