using ERPCore.Domain.Enums;

namespace ERPCore.Domain.Entities;

/// <summary>
/// Cycle/full physical count header (FR-STK-08). System quantities are snapshotted
/// at creation and are immutable once opened (02-SECURITY C.7); posting emits a
/// variance adjustment. Mutable aggregate with an <see cref="RowVersion"/> token.
/// Model: docs/10 Part C.6.
/// </summary>
public class StockCount
{
    public int CountId { get; set; }
    public string DocNo { get; set; } = string.Empty;

    public int WarehouseId { get; set; }
    public Warehouse? Warehouse { get; set; }

    public CountType CountType { get; set; }
    public CountStatus Status { get; set; } = CountStatus.Draft;

    public int CreatedBy { get; set; }
    public User? Creator { get; set; }

    public DateTime CreatedAt { get; set; }
    public uint RowVersion { get; set; }

    public ICollection<StockCountLine> Lines { get; set; } = new List<StockCountLine>();
}
