<?php

namespace CouponsPlus\App\Coupon\Tree\Testable;

use CouponsPlus\App\Conditions\ItemsSet;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeData;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeDataFilterableSet;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeDatas;

class IgnoreListAdderOnEmptySetFiltererFromNodeData extends SetFiltererFromNodeDataDecorator implements NodeDataFilterableSet
{
    public function filterSet(ItemsSet $itemsSet, NodeData $nodeData, NodeDatas $relatedNodeDatas): ItemsSet
    {
        (object) $filteredSet = $this->setFilterer->filterSet($itemsSet, $nodeData, $relatedNodeDatas);

        $relatedNodeDatas->addToIgnoreList($nodeData);
        
        return $filteredSet;
    } 
}