using ERPCore.Domain.Enums;

namespace ERPCore.Domain.Entities;

public class SalesSlip
{
    public int SalesSlipId { get; set; }
    public string SlipNo { get; set; } = string.Empty;
    public DateTime SlipDate { get; set; }

    public int CustomerId { get; set; }
    public Customer? Customer { get; set; }

    public string CustomerSnapshotName { get; set; } = string.Empty;
    public int WarehouseId { get; set; }
    public Warehouse? Warehouse { get; set; }

    public int CashierUserId { get; set; }
    public User? CashierUser { get; set; }

    public SalesSlipStatus Status { get; set; } = SalesSlipStatus.Draft;

    public decimal Subtotal { get; set; }
    public decimal DiscountTotal { get; set; }
    public decimal TaxTotal { get; set; }
    public decimal GrandTotal { get; set; }
    public decimal PaidAmount { get; set; }
    public decimal BalanceAmount { get; set; }

    /// <summary>Set once this slip's business date is closed by <see cref="SalesDayEnd"/> — a closed slip is frozen (no further edits).</summary>
    public int? DayEndId { get; set; }
    public SalesDayEnd? DayEnd { get; set; }

    public DateTime CreatedAt { get; set; }
    public DateTime? UpdatedAt { get; set; }

    public uint RowVersion { get; set; }

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