using System;
using Svrnty.CQRS.Events.Abstractions.EventStore;
namespace Svrnty.CQRS.Events.Abstractions.Models;
///
/// Base class for correlated events with automatic framework-managed properties.
/// Inherit from this class to avoid manually specifying EventId, CorrelationId, and OccurredAt.
///
public abstract record CorrelatedEvent : ICorrelatedEvent
{
///
/// Unique identifier for this event instance.
/// Automatically generated when the event is created.
///
public string EventId { get; init; } = Guid.NewGuid().ToString();
///
/// Correlation ID linking this event to the command that caused it.
/// Automatically set by the framework after the command handler completes.
///
public string CorrelationId { get; set; } = string.Empty;
///
/// Timestamp when the event occurred.
/// Automatically set to UTC now when the event is created.
///
public DateTimeOffset OccurredAt { get; init; } = DateTimeOffset.UtcNow;
}