using System;
namespace Svrnty.CQRS.Events.Abstractions.Models;
///
/// Metadata about a persistent event stream.
///
///
/// Provides information about the stream's current state, including its length,
/// retention policy, and the oldest event still available in the stream.
///
public sealed record StreamMetadata
{
///
/// The name of the stream.
///
public required string StreamName { get; init; }
///
/// The current length of the stream (total number of events).
///
///
/// This represents the highest offset + 1. For example, if the stream has events
/// at offsets 0-99, the length is 100.
///
public required long Length { get; init; }
///
/// The offset of the oldest event still available in the stream.
///
///
/// Due to retention policies, older events may have been deleted.
/// This indicates the earliest offset that can still be read.
///
public required long OldestEventOffset { get; init; }
///
/// The timestamp of the oldest event still available in the stream.
///
///
/// Useful for monitoring retention policy effectiveness and data age.
/// Null if the stream is empty.
///
public DateTimeOffset? OldestEventTimestamp { get; init; }
///
/// The timestamp of the newest (most recent) event in the stream.
///
///
/// Null if the stream is empty.
///
public DateTimeOffset? NewestEventTimestamp { get; init; }
///
/// The retention policy for this stream, if configured.
///
///
/// Specifies how long events should be retained before deletion.
/// Null means no time-based retention (events retained indefinitely or until other policies apply).
///
public TimeSpan? RetentionPolicy { get; init; }
///
/// Indicates whether this is an empty stream.
///
public bool IsEmpty => Length == 0;
///
/// The total number of events that have been deleted from this stream due to retention policies.
///
///
/// Helps track data retention and compliance with data lifecycle policies.
///
public long DeletedEventCount { get; init; }
}