using System; using System.Collections.Generic; using System.Collections.ObjectModel; namespace TheXamlGuy.Framework.Core { public class EventConfiguration : IEventBuilderConfiguration where TEvent : class { private readonly List descriptors = new(); public EventConfiguration() { } public IReadOnlyCollection Descriptors => new ReadOnlyCollection(descriptors); public Action? Factory { get; } public Action? Next { get; } public IEventBuilderConfiguration WithHandler() where THandlerEvent : class { descriptors.Add(new EventDescriptor()); return this; } public IEventBuilderConfiguration WithHandler(Func factoryDelegate) where THandlerEvent : class { descriptors.Add(new EventDescriptor(factoryDelegate)); return this; } public IEventBuilderConfiguration WithHandler(Func factoryDelegate) where THandlerEvent : class { descriptors.Add(new EventDescriptor(factoryDelegate)); return this; } } }