#nullable enable
using Baya.Application.Models.Common;
using Baya.Application.Models.Refunds;
using Mediator;

namespace Baya.Application.Features.Refunds.Commands.CreateRefund;

/// <summary>
/// Admin-initiated, ticket-linked reversal of a captured booking payment. Either supply <see cref="RefundPercentage"/>
/// (a 0–1 fraction applied pro-rata to the booking's commission/payout legs) or the explicit
/// <see cref="PlatformFeeRefundedIrr"/> + <see cref="NursePayoutRefundedIrr"/> legs (which must still sum to the
/// refunded amount). When neither the command nor the booking's cancellation snapshot resolves a percentage the
/// request is rejected. Providing <see cref="ManualBankReference"/> forces the <c>manual</c> (out-of-band bank)
/// channel; otherwise the channel is derived from the original payment type (card ⇒ <c>psp_card</c>, BNPL ⇒
/// <c>bnpl_revert</c>).
/// </summary>
public record CreateRefundCommand(
    long BookingId,
    long? TicketId,
    decimal? RefundPercentage,
    long? PlatformFeeRefundedIrr,
    long? NursePayoutRefundedIrr,
    string? ReasonCategory,
    string? ReasonNotes,
    string? AdminNotes,
    string? ManualBankReference) : IRequest<OperationResult<CreateRefundResult>>;
