Files
OpenNest/OpenNest.Engine/Jobs/NestJobResult.cs
T
aj 451841401a refactor(engine): align namespaces with directory layout under OpenNest.Engine
All 132 OpenNest.Engine source files now declare namespaces matching
their nested directories: Jobs/, Jobs/Placement/, Jobs/Adapters/,
Fill/, RectanglePacking/, CirclePacking/, and engine-root types moved
from 'OpenNest' to 'OpenNest.Engine'. RootNamespace updated accordingly.
Consumers (Api, Console, Mcp, Benchmark, Training, desktop app, tests)
gained the explicit usings the move requires; CLAUDE.md updated.
2026-09-21 13:18:34 -04:00

84 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
namespace OpenNest.Engine.Jobs;
public enum NestJobStatus
{
Complete,
Incomplete,
}
public enum NestJobStopReason
{
Completed,
StockExhausted,
NoPlacementFound,
PlateLimitReached,
}
/// <summary>
/// Rotate about the snapshot origin, then translate by X/Y into the selected plate quadrant frame.
/// Rotation is in radians. InstanceIndex is zero-based and unique within a part requirement across the job.
/// The runner assigns final instance indices when committing a candidate.
/// </summary>
public sealed record NestJobPlacement(
string PartId,
int InstanceIndex,
double X,
double Y,
double Rotation
);
/// <summary>Requested = Placed + Unplaced for a requirement ID.</summary>
public sealed record PartFulfillment(string PartId, int Requested, int Placed, int Unplaced);
/// <summary>Used counts physical sheets; Remaining is null only for unlimited stock.</summary>
public sealed record StockUsage(string StockId, int Used, int? Remaining);
/// <summary>One physical sheet, with owned ordered placements and immutable stock/settings snapshot.</summary>
public sealed class NestJobPlateResult
{
public NestJobPlateResult(
int plateIndex,
NestPlateStock stock,
IEnumerable<NestJobPlacement> placements
)
{
ArgumentNullException.ThrowIfNull(stock);
PlateIndex = plateIndex;
Stock = stock;
Placements = NestJob.Own(placements);
}
public int PlateIndex { get; }
public string StockId => Stock.Id;
public NestPlateStock Stock { get; }
public IReadOnlyList<NestJobPlacement> Placements { get; }
}
/// <summary>Detached result values in commit/input order; no mutable Drawing, Plate, or NestItem escapes.</summary>
public sealed class NestJobResult
{
public NestJobResult(
NestJobStatus status,
NestJobStopReason stopReason,
IEnumerable<NestJobPlateResult> plates,
IEnumerable<PartFulfillment> fulfillment,
IEnumerable<StockUsage> stockUsage
)
{
Status = status;
StopReason = stopReason;
Plates = NestJob.Own(plates);
Fulfillment = NestJob.Own(fulfillment);
StockUsage = NestJob.Own(stockUsage);
}
public NestJobStatus Status { get; }
public NestJobStopReason StopReason { get; }
public IReadOnlyList<NestJobPlateResult> Plates { get; }
public IReadOnlyList<PartFulfillment> Fulfillment { get; }
public IReadOnlyList<StockUsage> StockUsage { get; }
}