namespace OpenNest.Data;
///
/// The sheets a saved nest needs and the parts it places, returned by
/// GET /api/nests/{id}/sheets. Read from the stored archive at .
///
public sealed class NestSheets
{
public Guid NestId { get; init; }
public int Revision { get; init; }
/// The nest's units, which every size in is stored in.
public Units Units { get; init; }
/// One entry per distinct sheet size, ordered by width, then length.
public IReadOnlyList Sheets { get; init; } = Array.Empty();
/// One entry per drawing, including drawings with nothing nested, ordered by name.
public IReadOnlyList Parts { get; init; } = Array.Empty();
/// One entry per plate in nest order, the same plates groups.
public IReadOnlyList Plates { get; init; } = Array.Empty();
}
///
/// One plate of the nest: its size as stored with the shorter side, how many
/// times it is cut, and the inventory item each of those sheets is cut from.
///
public sealed class NestPlateSheet
{
/// The plate's 0-based position in the nest.
public int Index { get; init; }
public double Width { get; init; }
public double Length { get; init; }
public int Quantity { get; init; }
///
/// Entry i is the inventory item code of sheet i; sheets past the end are uncoded, and a
/// bundle used for several sheets repeats its code. Empty when no sheet is coded.
///
public IReadOnlyList StockItemCodes { get; init; } = Array.Empty();
///
/// The rectangular drop each of this plate's sheets is expected to leave, as the desktop
/// computed it at save; null when none (or the file predates it).
///
public NestExpectedRemnant? ExpectedRemnant { get; init; }
}
/// A plate's expected drop as stored, with the shorter side.
public sealed class NestExpectedRemnant
{
public double Width { get; init; }
public double Length { get; init; }
/// cutoff when a full-span cut-off frees it, offcut for the largest edge strip.
public string Source { get; init; } = "";
}
/// A sheet size as stored, with the shorter side.
public sealed class NestSheetSize
{
public double Width { get; init; }
public double Length { get; init; }
/// Sheets of this size to cut: the sum of each such plate's quantity.
public int Quantity { get; init; }
}
/// How many of one drawing the nest requires and how many it places.
public sealed class NestPartCount
{
public string Name { get; init; } = "";
public int Required { get; init; }
/// Parts placed across all plates, each plate counted by its quantity.
public int Nested { get; init; }
}