namespace CMSMicroservice.Application.Common;

/// <summary>
/// Canonical scope keys for <see cref="Interfaces.IUserPaymentLock"/>.
/// </summary>
public static class PaymentLockScopes
{
    /// <summary>One active payment initiation per user (package, wallet charge, order, IPG deposit).</summary>
    public static string Initiate(long userId) => $"payment:initiate:user:{userId}";

    /// <summary>One active verify per user + authority/order (duplicate callback protection).</summary>
    public static string Verify(long userId, string resourceKey)
    {
        if (string.IsNullOrWhiteSpace(resourceKey))
            throw new ArgumentException("Payment verify resource key is required.", nameof(resourceKey));

        return $"payment:verify:user:{userId}:{resourceKey.Trim()}";
    }
}
