using System;
using Svrnty.CQRS.Events.Abstractions.EventStore;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Svrnty.CQRS.Events.Abstractions.Models;
namespace Svrnty.CQRS.Events.Abstractions.EventStore;
///
/// Storage abstraction for persisting and retrieving events.
/// Implementations can use any storage mechanism (SQL, NoSQL, in-memory, etc.).
///
public interface IEventStore
{
///
/// Append an event to the store and assign it a sequence number.
///
/// The event to store.
/// Cancellation token.
/// The sequence number assigned to this event.
Task AppendAsync(ICorrelatedEvent @event, CancellationToken cancellationToken = default);
///
/// Append multiple events in a batch.
///
/// The events to store.
/// Cancellation token.
/// Dictionary mapping event IDs to their sequence numbers.
Task> AppendBatchAsync(IEnumerable events, CancellationToken cancellationToken = default);
///
/// Get events for a specific correlation ID.
///
/// The correlation ID to query.
/// Only return events after this sequence number (for catch-up).
/// Optional filter for specific event types.
/// Cancellation token.
/// List of stored events ordered by sequence.
Task> GetEventsAsync(
string correlationId,
long afterSequence = 0,
HashSet? eventTypes = null,
CancellationToken cancellationToken = default);
///
/// Get a specific event by its ID.
///
/// The event ID.
/// Cancellation token.
/// The stored event, or null if not found.
Task GetEventByIdAsync(string eventId, CancellationToken cancellationToken = default);
///
/// Delete events older than the specified date (for cleanup/retention policies).
///
/// Delete events older than this date.
/// Cancellation token.
/// Number of events deleted.
Task DeleteOldEventsAsync(DateTimeOffset olderThan, CancellationToken cancellationToken = default);
}