using Mediator; using System.Diagnostics; namespace Toolkit.Framework.Foundation; public class Mediator : IMediator { private readonly IServiceProvider factory; public Mediator(IServiceProvider factory) { this.factory = factory; } public IAsyncEnumerable CreateStream(IStreamQuery query, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public IAsyncEnumerable CreateStream(IStreamRequest request, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public IAsyncEnumerable CreateStream(IStreamCommand command, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public IAsyncEnumerable CreateStream(object request, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public ValueTask Publish(TNotification notification, CancellationToken cancellationToken = default) where TNotification : INotification { throw new NotImplementedException(); } public ValueTask Publish(object notification, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public ValueTask Send(IRequest request, CancellationToken cancellationToken = default) { dynamic? handler = factory.GetService(typeof(RequestClassHandlerWrapper<,>).MakeGenericType(request.GetType(), typeof(TResponse))); if (handler is not null) { return handler.Handle((dynamic)request, cancellationToken); } return default; } public ValueTask Send(ICommand command, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public ValueTask Send(IQuery query, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } public ValueTask Send(object message, CancellationToken cancellationToken = default) { throw new NotImplementedException(); } }