namespace ERPCore.Domain.Entities;

/// <summary>
/// Transfer line (FR-STK-05/06). <see cref="Qty"/> is in base UOM.
/// <para>
/// Deviation note: <see cref="UnitCost"/> and <see cref="QtyReceived"/> extend
/// docs/10 Part C.6's <c>STOCK_TRANSFER_LINE</c> to make the transfer
/// cost-preserving: at dispatch the value-weighted cost of the consumed source
/// layers is stored here, and receive recreates the destination layer at that cost
/// (supports partial receive via <see cref="QtyReceived"/>).
/// </para>
/// </summary>
public class StockTransferLine
{
    public int TransferLineId { get; set; }

    public int TransferId { get; set; }
    public StockTransfer? Transfer { get; set; }

    public int ItemId { get; set; }
    public Item? Item { get; set; }

    public int? SrcBinId { get; set; }
    public int? DestBinId { get; set; }
    public int? BatchId { get; set; }
    public int? SerialId { get; set; }

    public decimal Qty { get; set; }

    /// <summary>Value-weighted unit cost of the consumed source layers (set at dispatch).</summary>
    public decimal? UnitCost { get; set; }

    /// <summary>Quantity already received at the destination (partial-receive support).</summary>
    public decimal QtyReceived { get; set; }
}
