namespace ERPCore.Domain.Entities;

/// <summary>
/// A parent → child arrow copied from the template's <see cref="StageEdge"/> set at run
/// creation.
/// <para><b>Addition to docs/30 Part C (recorded).</b> The doc's entity model has no run
/// edge table, but the run graph needs its own copy: deriving edges at read time through
/// <c>RunStage.TemplateStageId → STAGE_EDGE</c> would let a later template edit silently
/// rewrite completed-run history — the exact thing FR-MFG-06 exists to prevent — and
/// breaks outright once that link is nulled by a stage deletion.</para>
/// <para>Used for the run canvas, child-readiness evaluation and reject-intake's
/// "delivering parents". Note that <b>WIP delivery is routed by
/// <c>RunStageInput.FromRunOutputId</c>, not by these edges</b> — an edge is display and
/// validation only.</para>
/// </summary>
public class RunEdge
{
    public int RunEdgeId { get; set; }

    public int RunId { get; set; }
    public ProductionRun? Run { get; set; }

    public int ParentRunStageId { get; set; }
    public RunStage? ParentRunStage { get; set; }

    public int ChildRunStageId { get; set; }
    public RunStage? ChildRunStage { get; set; }
}
