2026-10-01 10:50:32 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
namespace App\Cqs\Queries\Orders;
|
2026-10-01 10:50:32 +02:00
|
|
|
|
|
|
|
|
use App\Contracts\Query;
|
|
|
|
|
use App\Contracts\QueryInput;
|
|
|
|
|
use Domain\Enums\OrderTunnelStep;
|
|
|
|
|
use Domain\Services\BasketService;
|
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-11-10 14:28:00 +01:00
|
|
|
* @implements \App\Contracts\Query<\App\Cqs\Queries\Orders\GetBasketSummaryQueryInput, \App\Cqs\Queries\Orders\GetBasketSummaryQueryOutput>
|
2026-10-01 10:50:32 +02:00
|
|
|
*/
|
|
|
|
|
final readonly class GetBasketSummaryQuery implements Query
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
private BasketService $basketService,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-11-10 14:28:00 +01:00
|
|
|
* @param \App\Cqs\Queries\Orders\GetBasketSummaryQueryInput $input
|
2026-10-01 10:50:32 +02:00
|
|
|
*/
|
|
|
|
|
#[\Override]
|
|
|
|
|
public function __invoke(QueryInput $input): GetBasketSummaryQueryOutput
|
|
|
|
|
{
|
|
|
|
|
Assert::isInstanceOf($input, GetBasketSummaryQueryInput::class);
|
|
|
|
|
|
|
|
|
|
return new GetBasketSummaryQueryOutput(
|
|
|
|
|
step: OrderTunnelStep::REVIEW,
|
|
|
|
|
basket: $this->basketService->getBasket(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|