public interface IIdempotencyService
{
    /// <summary>
    /// Returns the cached response if the key was already used, or null if this is a new key.
    /// </summary>
    Task<IdempotencyRecord?> GetExistingAsync(string idempotencyKey, string operationName);

    /// <summary>
    /// Stores the result of an operation for future deduplication.
    /// Must be called within the same transaction as the operation.
    /// </summary>
    Task SaveAsync(string idempotencyKey, string operationName, Guid resourceId,
        int httpStatusCode, object responseBody, TimeSpan? ttl = null);
}