<?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\NodeDatas;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeDataFilterableSet;

/**
 *
 * This is
 *
 * This is pretty much currently only for the BOGO offers to provide a default fallback when the user didn't specify a fixed quantity
 */
class PostItemsExclusionFromBranchFilterableSet extends SetFiltererFromNodeDataDecorator implements NodeDataFilterableSet
{
    public function filterSet(ItemsSet $itemsSet, NodeData $nodeData, NodeDatas $relatedNodeDatas): ItemsSet
    {
        return $this->setFilterer->filterSet(
            $itemsSet->withoutCollectionOf(
                $nodeData->getBranch()->getItemsToExclude($itemsSet), 'union'
            ),
            $nodeData,
            $relatedNodeDatas
        );
    }
}