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

namespace Baya.Application.Features.Bnpl.Commands.SettleBnplOrder;

/// <summary>
/// Settles a <c>verified</c> BNPL order: the provider pays the full order net of its commission, so this records
/// <c>settled_amount_irr</c>/<c>bnpl_commission_irr</c>/<c>settled_at</c> from the <b>actual settlement</b>,
/// posts the <b>net-of-fee</b> ledger group (card-capture legs PLUS the <c>bnpl_fee_expense</c> leg), confirms
/// the parent <c>payment_transaction</c> (which triggers the booking conversion), and transitions
/// <c>verified → settled</c>. Under <c>lock(bnpl:{id}:settle)</c>; carries an idempotency key. A replayed settle
/// is a no-op (state guard + webhook dedup + the settle-ledger idempotency probe).
/// </summary>
public record SettleBnplOrderCommand(long BnplTransactionId, string? IdempotencyKey = null, string? CallbackPayloadJson = null)
    : IRequest<OperationResult<bool>>;
