30 lines
785 B
PHP
30 lines
785 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Queries\ProductIncos;
|
|
|
|
use App\Contracts\Query;
|
|
use App\Contracts\QueryInput;
|
|
use App\Dto\ArcadiaIncoPreviewDto;
|
|
use App\Services\ArcadiaIncoService;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
/**
|
|
* @implements \App\Contracts\Query<\App\Queries\ProductIncos\GetArcadiaIncoPreviewQueryInput, ?\App\Dto\ArcadiaIncoPreviewDto>
|
|
*/
|
|
final readonly class GetArcadiaIncoPreviewQuery implements Query
|
|
{
|
|
public function __construct(
|
|
private ArcadiaIncoService $arcadiaIncoService,
|
|
) {
|
|
}
|
|
|
|
#[\Override]
|
|
public function __invoke(QueryInput $input): ?ArcadiaIncoPreviewDto
|
|
{
|
|
Assert::isInstanceOf($input, GetArcadiaIncoPreviewQueryInput::class);
|
|
|
|
return $this->arcadiaIncoService->getPreview($input->noArt);
|
|
}
|
|
}
|