public function preValidate(array $writeCommands, WriteContext $context): void
    {
        $violationList = new ConstraintViolationList();

        /** @var WriteCommandInterface $command */
        foreach ($writeCommands as $command) {
            if (!$command instanceof InsertCommand && !$command instanceof UpdateCommand) {
                continue;
            }

            switch (get_class($command->getDefinition())) {
                case PromotionDefinition::class:
                    $this->validatePromotion($command->getPayload(), $violationList);
                    break;

                case PromotionDiscountDefinition::class:
                    $this->validateDiscount($command->getPayload(), $violationList);
                    break;
            }
        }

        if ($violationList->count() > 0) {
            throw new WriteConstraintViolationException($violationList);
        }
    }