<?php

namespace App\Modules\WebContactMessage\Application\ListByWebContactMessage;

use App\Modules\WebContact\Domain\IdWebContact;
use App\Modules\WebContactMessage\Domain\IdWebContactMessage;
use App\Modules\WebContactMessage\Domain\ListByLeadWebContactMessage;
use App\Modules\WebContactMessage\Domain\WebContactMessageRepository;

final class WebContactMessageByLeadLister
{
    public function __construct(private WebContactMessageRepository $repository) {}

    public function __invoke(IdWebContactMessage $idWebContactMessage): ListByLeadWebContactMessageQueryResponse
    {
        return new ListByLeadWebContactMessageQueryResponse($this->repository->search(new ListByLeadWebContactMessage(
            $idWebContactMessage
        )));
    }
}
