87 lines
2.6 KiB
C#
87 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Svrnty.CQRS.Events.Abstractions.Configuration;
|
|
|
|
/// <summary>
|
|
/// Represents all configuration for a single stream.
|
|
/// </summary>
|
|
public class StreamConfiguration
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the unique stream name.
|
|
/// </summary>
|
|
public required string StreamName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the optional description of the stream.
|
|
/// </summary>
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets optional tags for categorizing and filtering streams.
|
|
/// </summary>
|
|
public Dictionary<string, string>? Tags { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the retention configuration for this stream.
|
|
/// </summary>
|
|
public RetentionConfiguration? Retention { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the dead letter queue configuration for this stream.
|
|
/// </summary>
|
|
public DeadLetterQueueConfiguration? DeadLetterQueue { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the lifecycle configuration for this stream.
|
|
/// </summary>
|
|
public LifecycleConfiguration? Lifecycle { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the performance configuration for this stream.
|
|
/// </summary>
|
|
public PerformanceConfiguration? Performance { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the access control configuration for this stream.
|
|
/// </summary>
|
|
public AccessControlConfiguration? AccessControl { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets when this configuration was created.
|
|
/// </summary>
|
|
public DateTimeOffset CreatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets when this configuration was last updated.
|
|
/// </summary>
|
|
public DateTimeOffset? UpdatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets who created this configuration.
|
|
/// </summary>
|
|
public string? CreatedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets who last updated this configuration.
|
|
/// </summary>
|
|
public string? UpdatedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// Validates the stream configuration.
|
|
/// </summary>
|
|
/// <exception cref="ArgumentException">Thrown when configuration is invalid.</exception>
|
|
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();
|
|
}
|
|
}
|