using PowderCoating.Core.Enums;
namespace PowderCoating.Core.Entities;
///
/// Records a refund issued to a customer against an invoice.
/// Does not move actual money — the shop issues the refund manually.
///
public class Refund : BaseEntity
{
public int InvoiceId { get; set; }
public int? PaymentId { get; set; } // Specific payment being refunded (optional)
public decimal Amount { get; set; }
public DateTime RefundDate { get; set; } = DateTime.UtcNow;
public PaymentMethod RefundMethod { get; set; }
public string Reason { get; set; } = string.Empty;
public string? Reference { get; set; } // Check #, transaction ID, etc.
public string? Notes { get; set; }
public RefundStatus Status { get; set; } = RefundStatus.Pending;
public DateTime? IssuedDate { get; set; }
public string? IssuedById { get; set; }
/// Bank/checking account the refund was paid from. Mirrors Payment.DepositAccountId so
/// the Trial Balance can credit this account when computing bank balance.
public int? DepositAccountId { get; set; }
// For store-credit refunds: the CreditMemo created on their behalf
public int? CreditMemoId { get; set; }
// Navigation
public virtual Invoice Invoice { get; set; } = null!;
public virtual Payment? Payment { get; set; }
public virtual ApplicationUser? IssuedBy { get; set; }
public virtual CreditMemo? CreditMemo { get; set; }
}