using System;
using Svrnty.CQRS.Events.Subscriptions;
using System.Collections.Generic;
namespace Svrnty.CQRS.Events.Management;
///
/// Information about an event stream for management API responses.
///
public sealed record StreamInfo
{
///
/// Name of the stream.
///
public required string Name { get; init; }
///
/// Stream type (Ephemeral or Persistent).
///
public required string Type { get; init; }
///
/// Delivery semantics (AtMostOnce, AtLeastOnce, ExactlyOnce).
///
public required string DeliverySemantics { get; init; }
///
/// Stream scope (Internal or CrossService).
///
public required string Scope { get; init; }
///
/// Current length of the stream (total events).
///
public long Length { get; init; }
///
/// Number of subscriptions on this stream.
///
public int SubscriptionCount { get; init; }
///
/// List of subscription IDs.
///
public List Subscriptions { get; init; } = new();
}
///
/// Information about a subscription for management API responses.
///
public sealed record SubscriptionInfo
{
///
/// Unique subscription identifier.
///
public required string SubscriptionId { get; init; }
///
/// Name of the stream this subscription consumes from.
///
public required string StreamName { get; init; }
///
/// Subscription mode (Broadcast, Exclusive, ConsumerGroup).
///
public required string Mode { get; init; }
///
/// Whether the subscription is active.
///
public bool IsActive { get; init; }
///
/// When the subscription was created.
///
public DateTimeOffset CreatedAt { get; init; }
///
/// Visibility timeout for in-flight events.
///
public TimeSpan VisibilityTimeout { get; init; }
///
/// Whether automatic upcasting is enabled.
///
public bool EnableUpcasting { get; init; }
///
/// Target event version for upcasting (null = latest).
///
public int? TargetEventVersion { get; init; }
///
/// Optional description of the subscription.
///
public string? Description { get; init; }
}
///
/// Information about a consumer for management API responses.
///
public sealed record ConsumerInfo
{
///
/// Consumer ID.
///
public required string ConsumerId { get; init; }
///
/// Current offset (position in stream).
///
public long Offset { get; init; }
///
/// Number of events the consumer is behind the stream head.
///
public long Lag { get; init; }
///
/// Last time the consumer updated its offset.
///
public DateTimeOffset LastUpdated { get; init; }
///
/// Whether the consumer appears to be stalled (no progress).
///
public bool IsStalled { get; init; }
}
///
/// Request to reset a consumer's offset.
///
public sealed record ResetOffsetRequest
{
///
/// The new offset to set. Use 0 to reset to the beginning.
/// Use -1 to set to the end (latest).
///
public long NewOffset { get; init; }
}