#nullable enable
using Baya.Application.Models.Booking;
using Baya.Domain.Entities.Booking;

namespace Baya.Application.Contracts.Persistence;

/// <summary>
/// Admin-managed cancellation/refund tiers. The resolver picks the active tier for an
/// <c>(applies_to, lead-time bucket)</c> at cancel time; its <c>code</c> + <c>refund_percentage</c> are then
/// frozen onto the booking (a later edit here never mutates a past cancellation).
/// </summary>
public interface ICancellationPolicyRepository
{
    /// <summary>The active tiers for an actor, ordered so the resolver can pick the first covering bucket.</summary>
    Task<IReadOnlyList<CancellationPolicy>> GetActiveForActorAsync(string appliesTo, CancellationToken cancellationToken);

    Task<IReadOnlyList<CancellationPolicyDto>> ListAsync(CancellationToken cancellationToken);

    /// <summary>Tracked lookup by unique <c>code</c> for the admin upsert; null when the code is new.</summary>
    Task<CancellationPolicy?> GetTrackedByCodeAsync(string code, CancellationToken cancellationToken);

    Task AddAsync(CancellationPolicy policy, CancellationToken cancellationToken);
}
