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

/// <summary>
/// The pre-cancel disclosure (REQ-020): resolves the applicable customer cancellation policy by the
/// <b>current</b> lead time and enumerates per-session refundability, so the fee/refund split is shown before
/// the customer confirms — an outside-policy fee is never a surprise. All IRR fields are digit-strings and
/// server-computed. <c>refundAmountIrr + feeAmountIrr = refundableAmountIrr</c>; the fee-leg split
/// (<c>platformFeeRefundedIrr</c>/<c>nursePayoutRefundedIrr</c>) is served, never client-derived.
/// </summary>
public record CancellationPolicyPreviewDto(
    long BookingId,
    bool Cancellable,
    string? CancellationPolicyCode,
    decimal? RefundPercentageApplied,
    decimal? FeePercentage,
    string RefundAmountIrr,
    string FeeAmountIrr,
    string RefundableAmountIrr,
    string PlatformFeeRefundedIrr,
    string NursePayoutRefundedIrr,
    string AppliesTo,
    string LeadTimeLabel,
    string RefundChannel,
    DateOnly? ExpectedCustomerRefundEta,
    IReadOnlyList<CancellationPreviewSessionDto> Sessions);

/// <summary>One session's refundability in the preview. <c>ReasonCode</c> is <c>un_started</c> when refundable,
/// else the blocking session status (e.g. <c>completed</c>/<c>in_progress</c>).</summary>
public record CancellationPreviewSessionDto(
    long BookingSessionId,
    int SessionIndex,
    DateOnly ScheduledDate,
    bool Refundable,
    string ReasonCode);
