<?php

namespace App\Modules\WebContactMessage\Application\ListRelated;

use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class ListRelatedWebContactMessageQueryHandler implements QueryHandler
{
    public function __construct(private WebContactMessageRelatedLister $inserter) {}

    public function __invoke(ListRelatedWebContactMessageQuery $query): ListRelatedWebContactMessageResponse
    {
        return new ListRelatedWebContactMessageResponse($this->inserter->__invoke(
            $query->email,
            $query->name,
            $query->lastName,
            $query->phone,
            $query->withBooking
        ));
    }
}
