evwiki/src/Domain/Search/View/FullBrand/FullBrandAiViewBuilder.php
2025-06-09 18:15:22 +02:00

38 lines
1.1 KiB
PHP

<?php
namespace App\Domain\Search\View\FullBrand;
use App\Domain\Model\Id\BrandId;
use App\Domain\Search\TileCollection;
use App\Domain\Search\View\AiViewBuilder;
final readonly class FullBrandAiViewBuilder implements AiViewBuilder
{
public function __construct(
private readonly FullBrandView $fullBrandView
) {}
public function buildView(array $data): TileCollection
{
if (!is_string($data['brand_id'] ?? null)) {
throw new \InvalidArgumentException('Brand ID is required');
}
return $this->fullBrandView->buildView(new BrandId($data['brand_id']));
}
public function dataDescription(): array
{
return [
'brand_id' => 'Brand ID',
];
}
public function description(): string
{
return <<<'EOT'
This view shows all information about a brand. It is used to display the full information about a brand if requested in the query.
E.g. a brand name is given. You should only use this view if you are really sure, that the query is about a brand and not models or revisions.
EOT;
}
}