protected function addPaletteCondition(PaletteConditionInterface $condition)
    {
        if (!$this->palette) {
            throw new DcGeneralRuntimeException('Palette is missing, please create a palette first');
        }

        $event = new AddConditionEvent($condition, $this->palette, $this);
        $this->dispatchEvent($event);
        $condition = $event->getCondition();

        $previousCondition = $this->palette->getCondition();

        if (!$previousCondition) {
            $this->palette->setCondition($condition);
        } elseif ($previousCondition instanceof PropertyConditionChain) {
            $previousCondition->addCondition($condition);
        } else {
            $chain = $this->paletteConditionChainClass->newInstance();
            $chain->addCondition($previousCondition);
            $chain->addCondition($condition);
            $this->palette->setCondition($chain);
        }
    }