<?php

namespace App\Modules\EndpointScope\Application\List;

use App\Modules\EndpointScope\Domain\EndpointScopeRepository;
use App\Modules\EndpointScope\Domain\ListEndpointScopesByApplication;

final class EndpointScopeLister
{
    public function __construct(
        private EndpointScopeRepository  $endpointScopeRepository,
    )
    {
    }

    public function __invoke(
        ListEndpointScopeQuery $query
    )
    {
        return $this->endpointScopeRepository->find(new ListEndpointScopesByApplication($query->endpointPath, $query->endpointMethod));
    }
}
