namespace OpenNest.Data;
///
/// One release of drawing sets, library drawings on their own, or both: the nests it made or
/// merged into, one per material group, with every member quantity multiplied by its set
/// line's quantity.
/// Releases are append-only; undoing one restores or deletes its nests and marks it
/// undone, it never removes the record.
///
public sealed class SetReleaseRecord
{
/// Allocated by the client, so an ambiguous post can be retried without a duplicate.
public Guid Id { get; set; }
/// The sets released and how many times each, in the order posted.
public IReadOnlyList Sets { get; set; } = Array.Empty();
///
/// Library drawings released on their own, outside any set, in the order posted. Empty for
/// a release of sets only and for every release recorded before schema v11.
///
public IReadOnlyList Drawings { get; set; } = Array.Empty();
public string Notes { get; set; } = "";
/// When the server stored the release. Server-computed.
public DateTime ReleasedAt { get; set; }
/// Who released the sets, as reported by the client.
public string ReleasedBy { get; set; } = "";
/// When the release was undone; null while it stands. Server-computed.
public DateTime? UndoneAt { get; set; }
/// Who undid the release, as reported by the client. Server-computed.
public string UndoneBy { get; set; } = "";
/// The nests the release created or merged into, in the order posted.
public IReadOnlyList Nests { get; set; } = Array.Empty();
public bool IsUndone => UndoneAt.HasValue;
}
/// One set of a release: the exact revision released and how many kits of it.
public sealed class SetReleaseLine
{
public Guid SetId { get; set; }
/// The exact set revision released; it need not be the current one.
public int SetRevision { get; set; }
/// How many kits: every member quantity is multiplied by this.
public int Quantity { get; set; } = 1;
/// The set's name at . Server-joined; ignored on post.
public string SetName { get; set; } = "";
}
/// One library drawing released on its own, outside any set, and how many of it.
public sealed class SetReleaseDrawing
{
public Guid DrawingId { get; set; }
public int Quantity { get; set; } = 1;
/// The drawing's current library name. Server-joined; ignored on post.
public string DrawingName { get; set; } = "";
}