namespace Books.Api.EventFlow.Repositories;

/// <summary>
/// Repository for querying ledger transaction data by idempotency key.
/// Used for idempotent retry handling when ledger returns "already processed".
/// </summary>
public interface ILedgerTransactionRepository
{
    /// <summary>
    /// Checks if a transaction was successfully processed (has ledger entries).
    /// Returns the transaction ID if found, null otherwise.
    /// </summary>
    /// <param name="idempotencyKey">The idempotency key used when posting the transaction</param>
    /// <param name="ct">Cancellation token</param>
    /// <returns>The transaction ID if ledger entries exist, null otherwise</returns>
    Task<string?> GetTransactionIdByIdempotencyKeyAsync(
        string idempotencyKey,
        CancellationToken ct = default);
}
