using CQRS.Validation;
using Serilog;

// Credits to <NAME> for this implementation
// https://stackoverflow.com/questions/52593426/registering-open-generic-decorators-through-a-single-binding-rule

namespace CQRS.Commands.Validators
{
    public class ValidatingCommandHandlerDecorator<TCommand> : ICommandHandler<TCommand>
    {
        private readonly ICommandHandler<TCommand> decoratee;
        private readonly IEnumerable<ICommandValidator<TCommand>> validators;

        public ValidatingCommandHandlerDecorator(
            IEnumerable<ICommandValidator<TCommand>> validators,