using System; using System.Collections.Generic; namespace Svrnty.CQRS.Events.Abstractions.Configuration; /// /// Configuration for stream access control and quotas. /// public class AccessControlConfiguration { /// /// Gets or sets whether anyone can read from this stream. /// public bool PublicRead { get; set; } /// /// Gets or sets whether anyone can write to this stream. /// public bool PublicWrite { get; set; } /// /// Gets or sets the list of users/services allowed to read from this stream. /// public List? AllowedReaders { get; set; } /// /// Gets or sets the list of users/services allowed to write to this stream. /// public List? AllowedWriters { get; set; } /// /// Gets or sets the maximum number of consumer groups allowed for this stream. /// public int? MaxConsumerGroups { get; set; } /// /// Gets or sets the maximum events per second rate limit for this stream. /// public long? MaxEventsPerSecond { get; set; } /// /// Validates the access control configuration. /// /// Thrown when configuration is invalid. public void Validate() { if (MaxConsumerGroups.HasValue && MaxConsumerGroups.Value < 0) throw new ArgumentException("MaxConsumerGroups cannot be negative", nameof(MaxConsumerGroups)); if (MaxEventsPerSecond.HasValue && MaxEventsPerSecond.Value <= 0) throw new ArgumentException("MaxEventsPerSecond must be positive", nameof(MaxEventsPerSecond)); } }