#nullable enable
namespace Baya.Application.Models.Invoices;

/// <summary>The booking facts <c>IssueInvoiceCommand</c> copies onto the invoice, plus the owning customer's
/// user id for the tenancy-scoped read. Money is IRR <c>long</c>.</summary>
public record InvoiceBookingAmounts(
    long BookingId,
    int CustomerUserId,
    long GrossIrr,
    long PlatformCommissionIrr,
    long? BnplCommissionIrr);

/// <summary>The booking's official invoice. Money crosses the wire as digit strings; the PDF URL is derived
/// from the stored object key when present.</summary>
public record InvoiceDto(
    long Id,
    long BookingId,
    string InvoiceNumber,
    string IssuingEntityType,
    string GrossIrr,
    string PlatformCommissionIrr,
    string? BnplCommissionIrr,
    decimal VatRate,
    string VatIrr,
    // The reconciling settlement total = platform commission + BNPL commission + VAT (IRR digit-string).
    string TotalIrr,
    string? MoadianReferenceNumber,
    string? MoadianStatus,
    string? PdfUrl,
    DateTime IssuedAt);

/// <summary>The tenancy envelope for the customer invoice read: the owning customer's user id plus the DTO
/// (with the raw PDF key so the handler can turn it into a URL through <c>IObjectStorage</c>).</summary>
public record InvoiceProjection(int CustomerUserId, string? PdfStorageKey, InvoiceDto Invoice);
