using Books.Api.Domain.Invoices;
using EventFlow.Aggregates;

namespace Books.Api.Domain.Invoices.Events;

/// <summary>
/// Raised when an invoice is sent to the customer and posted to the ledger.
/// This triggers the creation of ledger entries:
/// - Debit: Customer sub-ledger account (1900-XXXX)
/// - Credit: Revenue account + VAT account
/// </summary>
public class InvoiceSentEvent(
    string ledgerTransactionId,
    decimal amountExVat,
    decimal amountVat,
    decimal amountTotal,
    string sentBy,
    DateTimeOffset sentAt) : AggregateEvent<InvoiceAggregate, InvoiceId>
{
    public string LedgerTransactionId { get; } = ledgerTransactionId;
    public decimal AmountExVat { get; } = amountExVat;
    public decimal AmountVat { get; } = amountVat;
    public decimal AmountTotal { get; } = amountTotal;
    public string SentBy { get; } = sentBy;
    public DateTimeOffset SentAt { get; } = sentAt;
}
