<?php

namespace CouponsPlus\App\Coupon\Tree\Sets;

use CouponsPlus\App\Conditions\ItemsSet;
use CouponsPlus\App\Coupon\Tree\Sets\Abilities\ItemsSetSorterInterface;
use CouponsPlus\App\Coupon\Tree\Sets\Abilities\DescendingItemsSetSorterInterface;

class DescendingItemsSorter implements ItemsSetSorterInterface
{
    protected DescendingItemsSetSorterInterface $descendingItemsSetSorter;

    public function __construct(DescendingItemsSetSorterInterface $descendingItemsSetSorter)
    {
        $this->descendingItemsSetSorter = $descendingItemsSetSorter;
    }

    public function sort(ItemsSet $itemsSet): array
    {
        return $this->descendingItemsSetSorter->sortDescending($itemsSet);
    }
}