public function getPreconditionRule(): Rule
    {
        // we combine each topics with an AND and a OR inside of their rules.
        // so all topics have to match, and one topic needs at least 1 rule that matches.
        $requirements = new AndRule(
            []
        );

        $personasFound = false;
        $personaOR = new OrRule();

        // check if we have persona rules and add them
        // to our persona OR as a separate OR rule with all configured rules
        if ($this->getPersonaRules() !== null && count($this->getPersonaRules()->getElements()) > 0) {
            $personaRuleOR = new OrRule();

            /** @var RuleEntity $ruleEntity */
            foreach ($this->getPersonaRules()->getElements() as $ruleEntity) {
                // add rule our rule and also make sure
                // we know that at least a persona exists.
                $personaRuleOR->addRule($ruleEntity->getPayload());
                $personasFound = true;
            }

            $personaOR->addRule($personaRuleOR);
        }

        // check if we have customers.
        // if so, create customer rules for it and add that also as
        // a separate OR condition to our main persona rule
        if ($this->getPersonaCustomers() !== null) {
            $personaCustomerOR = new OrRule();

            /* @var CustomerEntity $ruleEntity */
            foreach ($this->getPersonaCustomers()->getElements() as $customer) {
                // build our new rule for this
                // customer and his/her customer number
                $custRule = new CustomerNumberRule();
                $custRule->assign(['numbers' => [$customer->getCustomerNumber()], 'operator' => CustomerNumberRule::OPERATOR_EQ]);

                // add rule for customer and make sure
                // we know that at least a persona exists.
                $personaCustomerOR->addRule($custRule);
                $personasFound = true;
            }

            $personaOR->addRule($personaCustomerOR);
        }

        // if we have found any persona rule
        // or customer, then add our main persona rule
        if ($personasFound) {
            $requirements->addRule($personaOR);
        }

        if ($this->getCartRules() !== null && count($this->getCartRules()->getElements()) > 0) {
            $cartOR = new OrRule([]);

            /** @var RuleEntity $ruleEntity */
            foreach ($this->getCartRules()->getElements() as $ruleEntity) {
                $cartOR->addRule($ruleEntity->getPayload());
            }

            $requirements->addRule($cartOR);
        }

        if ($this->getOrderRules() !== null && count($this->getOrderRules()->getElements()) > 0) {
            $orderOR = new OrRule([]);

            /** @var RuleEntity $ruleEntity */
            foreach ($this->getOrderRules()->getElements() as $ruleEntity) {
                $orderOR->addRule($ruleEntity->getPayload());
            }

            $requirements->addRule($orderOR);
        }

        return $requirements;
    }