<?php
declare(strict_types=1);
namespace Slivki\Controller\MobileApi\V2\MeOnMap;
use Slivki\Message\Query\MeOnMap\GetCategoriesWithGeoLocationsQuery;
use Slivki\MessageHandler\Query\MeOnMap\GetCategoriesWithGeoLocationsHandler;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use OpenApi\Annotations as OA;
final class GetCategoriesWithGeoLocationAction
{
private GetCategoriesWithGeoLocationsHandler $getCategoriesWithGeoLocationsHandler;
public function __construct(GetCategoriesWithGeoLocationsHandler $getCategoriesWithGeoLocationsHandler)
{
$this->getCategoriesWithGeoLocationsHandler = $getCategoriesWithGeoLocationsHandler;
}
/**
* @Route("/mobile/api/v2/me-on-map/categories/{cityId}", methods={"GET"}, name="mobile_api_v2_me_on_map_categories_get")
* @OA\Tag(name="Me on map")
* @OA\Response(
* response=200,
* description="Список категорий с геолокациями",
* @OA\Schema(
* @OA\Property(
* property="categories",
* description="Список категорий с геолокациями",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(property="id", type="integer"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="image", type="string"),
* @OA\Property(property="offersCount", type="integer"),
* @OA\Property(property="featurePosition", type="integer"),
* @OA\Property(
* property="offerIds",
* type="array",
* @OA\Items(type="integer"),
* ),
* ),
* ),
* @OA\Property(
* property="featuredCategories",
* description="Список топовых категорий с геолокациями",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(property="id", type="integer"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="image", type="string"),
* @OA\Property(property="offersCount", type="integer"),
* @OA\Property(property="featurePosition", type="integer"),
* @OA\Property(
* property="offerIds",
* type="array",
* @OA\Items(type="integer"),
* ),
* ),
* ),
* @OA\Property(
* property="featuredCategoryIds",
* description="[deprecated] Список айди выделенных категорий",
* type="array",
* @OA\Items(type="integer"),
* ),
* @OA\Property(
* property="featuredOffers",
* description="Список акций",
* type="array",
* @OA\Items(
* type="object",
* @OA\Property(property="id", type="integer"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="image", type="string"),
* @OA\Property(property="featurePosition", type="integer"),
* ),
* ),
* ),
* ),
* @OA\Parameter(
* name="cityId",
* in="path",
* description="ID города",
* required=true,
* @OA\Schema(type="integer"),
* ),
*/
public function __invoke(int $cityId): JsonResponse
{
return new JsonResponse(
$this->getCategoriesWithGeoLocationsHandler->__invoke(new GetCategoriesWithGeoLocationsQuery($cityId)),
);
}
}