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

namespace Baya.Application.Features.Payments.Commands.ConfirmPaymentAndPostLedger;

/// <summary>
/// Captures a verified payment: server-side re-verifies the attempt, creates/confirms the booking (through the
/// shared b9 conversion), posts the <b>balanced card-capture ledger group</b> (DEBIT <c>escrow_held</c> gross =
/// CREDIT <c>platform_revenue</c> commission + <c>nurse_payable</c> payout), and registers the تسهیم split.
/// It is <b>never a public endpoint</b> — dispatched only by <c>HandlePaymentWebhook</c> (and directly in
/// tests). Idempotent: an already-succeeded transaction, or a concurrent double-confirm caught by the filtered
/// <c>UNIQUE(booking_id) WHERE status='succeeded'</c>, is a no-op success.
/// </summary>
public record ConfirmPaymentAndPostLedgerCommand(long PaymentTransactionId) : IRequest<OperationResult<bool>>;
