<?php

namespace App\Modules\Group\Application\List;

use App\Modules\Group\Domain\ListGroup;
use App\Modules\Group\Domain\GroupDescription;
use App\Modules\Group\Domain\GroupRepository;
use App\Modules\Shared\Domain\DateEnd;
use App\Modules\Shared\Domain\DateStart;

final class GroupLister
{
    public function __construct(private GroupRepository $repository) {}

    public function __invoke(
        string $action,
        DateStart $dateStart,
        DateEnd $dateEnd,
        int $onlyTransfer
    ) {
        return $this->repository->search(new ListGroup(
            $action,
            $dateStart,
            $dateEnd,
            $onlyTransfer
        ));
    }
}
