using System;
using System.Collections.Generic;
namespace Svrnty.CQRS.Events.Abstractions.Configuration;
///
/// Represents all configuration for a single stream.
///
public class StreamConfiguration
{
///
/// Gets or sets the unique stream name.
///
public required string StreamName { get; set; }
///
/// Gets or sets the optional description of the stream.
///
public string? Description { get; set; }
///
/// Gets or sets optional tags for categorizing and filtering streams.
///
public Dictionary? Tags { get; set; }
///
/// Gets or sets the retention configuration for this stream.
///
public RetentionConfiguration? Retention { get; set; }
///
/// Gets or sets the dead letter queue configuration for this stream.
///
public DeadLetterQueueConfiguration? DeadLetterQueue { get; set; }
///
/// Gets or sets the lifecycle configuration for this stream.
///
public LifecycleConfiguration? Lifecycle { get; set; }
///
/// Gets or sets the performance configuration for this stream.
///
public PerformanceConfiguration? Performance { get; set; }
///
/// Gets or sets the access control configuration for this stream.
///
public AccessControlConfiguration? AccessControl { get; set; }
///
/// Gets or sets when this configuration was created.
///
public DateTimeOffset CreatedAt { get; set; }
///
/// Gets or sets when this configuration was last updated.
///
public DateTimeOffset? UpdatedAt { get; set; }
///
/// Gets or sets who created this configuration.
///
public string? CreatedBy { get; set; }
///
/// Gets or sets who last updated this configuration.
///
public string? UpdatedBy { get; set; }
///
/// Validates the stream configuration.
///
/// Thrown when configuration is invalid.
public void Validate()
{
if (string.IsNullOrWhiteSpace(StreamName))
throw new ArgumentException("StreamName cannot be null or whitespace", nameof(StreamName));
Retention?.Validate();
DeadLetterQueue?.Validate();
Lifecycle?.Validate();
Performance?.Validate();
AccessControl?.Validate();
}
}