using OpenNest;
namespace OpenNest.Data;
/// How a release reached one of its nests.
public enum SetReleaseNestKind
{
/// The release uploaded the nest as new.
Created,
/// The release added its parts to an existing draft nest and renested it.
Merged,
}
/// What undoing the release did to one of its nests.
public enum SetReleaseNestUndo
{
/// A created nest was deleted (it can still be recovered).
Deleted,
/// A merged nest was restored to .
Restored,
/// The operator left the nest as it was, because it had changed since the release.
Skipped,
}
/// One nest of a release, the material group it was made for, and what the release put in it.
public sealed class SetReleaseNest
{
public Guid NestId { get; set; }
public SetReleaseNestKind Kind { get; set; } = SetReleaseNestKind.Created;
/// The draft's revision the release merged into; null for a created nest.
public int? RevisionBefore { get; set; }
/// The nest revision the release wrote. Undo acts only while the nest is still at it.
public int RevisionAfter { get; set; }
public string MaterialName { get; set; } = "";
public string MaterialGrade { get; set; } = "";
/// Thickness in , stored rounded to four decimals.
public double Thickness { get; set; }
public Units Units { get; set; } = Units.Inches;
public CutType CutType { get; set; } = CutType.Laser;
///
/// The drawing quantities this release added to the nest, per set and for the drawings
/// released on their own. Empty for releases
/// recorded before items were kept (schema v8).
///
public IReadOnlyList Items { get; set; } = Array.Empty();
/// What undoing the release did to the nest; null while the release stands. Server-computed.
public SetReleaseNestUndo? Undo { get; set; }
/// The nest revision the undo wrote; null when it wrote none. Server-computed.
public int? UndoRevision { get; set; }
///
/// The nest's current metadata, deleted or not, joined by the server when it reads a
/// release, so status and deletion are always up to date. Ignored on post.
///
public NestRecord? Nest { get; set; }
}
/// A drawing quantity one set of a release, or the drawing released on its own, added to one nest.
public sealed class SetReleaseNestItem
{
/// The set that asked for the quantity; null for a drawing released on its own.
public Guid? SetId { get; set; }
public Guid DrawingId { get; set; }
/// The library revision of the drawing that went into the nest.
public int DrawingRevision { get; set; }
public int Quantity { get; set; }
}