using System;
using System.Threading;
using System.Threading.Tasks;
namespace Svrnty.CQRS.Sagas.Abstractions;
///
/// Orchestrates saga execution.
///
public interface ISagaOrchestrator
{
///
/// Starts a new saga instance with a generated correlation ID.
///
/// The saga type.
/// The saga data type.
/// The initial saga data.
/// Cancellation token.
/// The saga state.
Task StartAsync(TData initialData, CancellationToken cancellationToken = default)
where TSaga : ISaga
where TData : class, ISagaData, new();
///
/// Starts a new saga instance with a specific correlation ID.
///
/// The saga type.
/// The saga data type.
/// The initial saga data.
/// The correlation ID for tracing.
/// Cancellation token.
/// The saga state.
Task StartAsync(TData initialData, Guid correlationId, CancellationToken cancellationToken = default)
where TSaga : ISaga
where TData : class, ISagaData, new();
///
/// Gets the current state of a saga by its ID.
///
/// The saga instance ID.
/// Cancellation token.
/// The saga state, or null if not found.
Task GetStateAsync(Guid sagaId, CancellationToken cancellationToken = default);
///
/// Gets the current state of a saga by its correlation ID.
///
/// The correlation ID.
/// Cancellation token.
/// The saga state, or null if not found.
Task GetStateByCorrelationIdAsync(Guid correlationId, CancellationToken cancellationToken = default);
}