using Baya.Application.Models.Bnpl;
using Baya.Application.Models.Common;
using Mediator;

namespace Baya.Application.Features.Bnpl.Queries.CheckBnplEligibility;

/// <summary>
/// Checks whether a family can finance an <c>accepted_awaiting_payment</c> booking request with the chosen BNPL
/// provider, and records the outcome on a created/updated <c>bnpl_transactions</c> row (status <c>eligible</c>).
/// The order amount is the request's frozen gross (variant price × session count) — never client-supplied. The
/// client shows the plan summary on <c>eligible</c> or falls back to card. Owned by the requesting customer.
/// </summary>
/// <param name="BookingRequestId">The accepted request to finance (a b9 <c>bookings</c> row exists only on settle).</param>
/// <param name="ProviderCode">Which BNPL provider to check (<c>snapppay</c>/<c>digipay</c>/<c>tara</c>/<c>torobpay</c>/<c>balinyaar</c>).</param>
/// <param name="NationalId">The D3 credit-inquiry national id (optional; used for the provider KYC inquiry).</param>
/// <param name="Mobile">The D3 credit-inquiry mobile (optional; falls back to the account mobile).</param>
/// <param name="Consent">The D3 consent checkbox — must be true when the KYC inputs are supplied.</param>
public record CheckBnplEligibilityQuery(
    long BookingRequestId,
    string ProviderCode,
    string NationalId = null,
    string Mobile = null,
    bool? Consent = null) : IRequest<OperationResult<BnplEligibilityDto>>;
