dotnet-cqrs/Svrnty.CQRS.Events.Abstractions/Models/StoredEvent.cs

48 lines
1.3 KiB
C#

using System;
using Svrnty.CQRS.Events.Abstractions.Models;
using Svrnty.CQRS.Events.Abstractions.EventStore;
namespace Svrnty.CQRS.Events.Abstractions.Models;
/// <summary>
/// Represents a stored event with its metadata.
/// Used for event persistence and catch-up delivery.
/// </summary>
public sealed class StoredEvent
{
/// <summary>
/// Unique identifier for this event.
/// </summary>
public required string EventId { get; init; }
/// <summary>
/// Correlation ID linking this event to a command.
/// </summary>
public required string CorrelationId { get; init; }
/// <summary>
/// Type name of the event (e.g., "UserInvitationSentEvent").
/// </summary>
public required string EventType { get; init; }
/// <summary>
/// Global sequence number for ordering.
/// </summary>
public required long Sequence { get; init; }
/// <summary>
/// The actual event instance.
/// </summary>
public required ICorrelatedEvent Event { get; init; }
/// <summary>
/// When this event occurred.
/// </summary>
public required DateTimeOffset OccurredAt { get; init; }
/// <summary>
/// When this event was stored.
/// </summary>
public required DateTimeOffset StoredAt { get; init; }
}