using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class GoodsReceipt : Template
{
/// Null for a direct receipt (goods received without a purchase order).
public Guid? FK_PurchaseOrderId { get; set; }
[ForeignKey("FK_PurchaseOrderId")]
public PurchaseOrder? PurchaseOrder { get; set; }
/// Optional supplier for a direct receipt; for PO receipts the supplier comes from the PO.
public Guid? FK_SupplierId { get; set; }
[ForeignKey("FK_SupplierId")]
public Supplier? Supplier { get; set; }
public Guid FK_ReceivedByUserId { get; set; }
///
/// Warehouse the accepted quantities are received into. Not listed as a field in
/// docs/15_procurement.md's GoodsReceipt table, but required to write StockBalance/
/// StockMovement rows (both keyed by LocationId+LocationType) for the accepted quantities.
///
public Guid FK_WarehouseId { get; set; }
[ForeignKey("FK_WarehouseId")]
public Warehouse Warehouse { get; set; }
public DateTime ReceivedAt { get; set; } = DateTime.Now;
public ICollection Items { get; set; } = [];
}
}