using System.Threading;
using Svrnty.CQRS.Events.Abstractions.Correlation;
using System.Threading.Tasks;
namespace Svrnty.CQRS.Events.Abstractions.Correlation;
///
/// Storage for correlation ID mappings based on business data keys.
/// Allows workflows to be correlated based on business logic rather than explicit ID passing.
///
public interface ICorrelationStore
{
///
/// Get the correlation ID for a given key.
/// Returns null if no correlation exists for this key.
///
/// Hash of the correlation key.
/// Cancellation token.
/// The correlation ID if it exists, null otherwise.
Task GetCorrelationIdAsync(string keyHash, CancellationToken cancellationToken = default);
///
/// Store a correlation ID for a given key.
/// This creates the mapping between business data and correlation ID.
///
/// Hash of the correlation key.
/// The correlation ID to associate with this key.
/// Cancellation token.
Task SetCorrelationIdAsync(string keyHash, string correlationId, CancellationToken cancellationToken = default);
}