<?php

namespace CouponsPlus\App\Coupon\Tree\Sets;

use CouponsPlus\App\Conditions\ItemsSet;
use CouponsPlus\Original\Collections\Collection;

use CouponsPlus\App\Conditions\Abilities\ItemsSetFilter;

class KeepsSameSorterItemsSetFiltererComposite extends ItemsSetFilterComposite implements ItemsSetFilter
{
    public function filterSet(ItemsSet $itemsSet): ItemsSet
    {
        $this->itemsSetFilters = Collection::create($this->itemsSetFilters)->map(function(ItemsSetFilter $itemsSetFilter) {
            return new KeepsSameSorterItemsSetFiltererDecorator($itemsSetFilter);
        })->asArray();

        return parent::filterSet($itemsSet);
    }
}