<?php

namespace App\Modules\Leads\WebPage\Application\Delete;

use App\Modules\Leads\WebPage\Domain\IdWebPage;
use App\Modules\Leads\WebPage\Domain\WebPageRepository;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;

final class DeleteWebPageQueryHandler implements QueryHandler
{
    public function __construct(
        private WebPageDeleter $deleter,
        private WebPageRepository $repository
    ) {}

    public function __invoke(DeleteWebPageQuery $query): DeleteWebPageResponse
    {
        $this->deleter->__invoke(new IdWebPage($query->idWebPage()), true);
        return new DeleteWebPageResponse();
    }
}
