<?php

namespace App\Modules\Leads\WebChannel\Application\Insert;

use App\Modules\Leads\WebChannel\Domain\IdWebChannel;
use App\Modules\Leads\WebChannel\Domain\WebChannelBookingType;
use App\Modules\Leads\WebChannel\Domain\WebChannelCode;
use App\Modules\Leads\WebChannel\Domain\WebChannelDate;
use App\Modules\Leads\WebChannel\Domain\WebChannelDateUpdate;
use App\Modules\Leads\WebChannel\Domain\WebChannelIcon;
use App\Modules\Leads\WebChannel\Domain\WebChannelIconThumb;
use App\Modules\Leads\WebChannel\Domain\WebChannelName;
use App\Modules\Leads\WebChannel\Domain\WebChannelStatus;
use App\Modules\Leads\WebChannel\Domain\WebChannelVersion;
use App\Modules\Shared\Domain\Bus\Query\QueryHandler;
use App\Modules\TypeProvider\Domain\IdTypeProvider;

final class InsertWebChannelQueryHandler implements QueryHandler
{
    public function __construct(private WebChannelInserter $inserter) {}

    public function __invoke(InsertWebChannelQuery $query): InsertWebChannelResponse
    {
        return new InsertWebChannelResponse($this->inserter->__invoke(
            new IdWebChannel(0),
            new WebChannelDate($query->date()),
            new WebChannelDateUpdate($query->dateUpdate()),
            new WebChannelName($query->name()),
            new WebChannelIcon($query->icon()),
            new WebChannelIconThumb($query->iconThumb()),
            new WebChannelVersion(1),
            new WebChannelStatus($query->status()),
            $query->idAdmin(),
            new WebChannelBookingType($query->bookingType()),
        ));
    }
}
