<?php
namespace App\Controller\API;
use App\Controller\BaseController;
use App\Entity\Log\LogInteraction;
use App\Services\API\DescubrirBaService;
use App\Utils\APIResponse;
use App\Utils\CommonFunctions;
use Exception;
use OpenApi\Annotations as OA;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/descubrir-ba")
*/
class DescubrirBaController extends BaseController
{
/**
* @Route("/al-aire-libre", name="get_descubrir_ba_al_aire_libre", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/al-aire-libre",
* summary="Obtener eventos del agrupador 'Al aire Libre'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosAlAireLibreAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_AL_AIRE_LIBRE');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_AL_AIRE_LIBRE');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador, $endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/ciudad-como-escenario", name="get_descubrir_ba_ciudad_escenario", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/ciudad-como-escenario",
* summary="Obtener eventos del agrupador 'Ciudad como escenario'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function ciudadComoEscenarioAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_CIUDAD_ESCENARIO');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_CIUDAD_COMO_ESCENARIO');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador, $endpointAgrupador, false);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/destacado", name="get_descubrir_ba_destacado", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/destacado",
* summary="Obtener eventos del agrupador 'Destacado'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosDestacadoAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_DESTACADO');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/destacados-carrusel", name="get_descubrir_ba_destacados_carrusel", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/destacados-carrusel",
* summary="Obtener eventos del agrupador 'Destacados Carrusel'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosDestacadosCarruselAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_DESTACADOS_CARRUSEL');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/eventos-especiales", name="get_descubrir_ba_eventos_especiales", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/eventos-especiales",
* summary="Obtener eventos del agrupador 'Eventos Especiales'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosEspecialesAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_ESPECIALES');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_ESPECIALES');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador, $endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/eventos-propios", name="get_descubrir_ba_eventos_propios", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/eventos-propios",
* summary="Obtener eventos del agrupador 'Eventos propios'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosPropiosAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_PROPIOS');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_PROPIOS');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador, $endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/revivi", name="get_descubrir_ba_revivi", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/revivi",
* summary="Obtener eventos del agrupador 'RevivĂ'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosReviviAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_REVIVI');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_REVIVI');
$result = $descubrirBaService->getEventosRevivi($nombreAgrupador, $endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/eventos-gratuitos", name="get_descubrir_ba_eventos_gratuitos", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/eventos-gratuitos",
* summary="Obtener eventos del agrupador 'Eventos Gratuitos'",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosGratuitosAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$nombreAgrupador = CommonFunctions::getParameter('DESCUBRIR_BA_EVENTOS_GRATUITOS');
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_EVENTOS_GRATUITOS');
$result = $descubrirBaService->getEventosByAgrupador($nombreAgrupador, $endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
/**
* @Route("/agenda", name="get_descubrir_ba_agenda", methods={"GET"})
* @param Request $request
* @param DescubrirBaService $descubrirBaService
* @return Response
*
* @OA\Get(
* path="/api/v1/descubrir-ba/agenda",
* summary="Obtener eventos recurrentes",
* @OA\Response(
* response=200,
* description="Response",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(property="status", type="integer"),
* @OA\Property(property="errors", type="array", @OA\Items(type="string")),
* @OA\Property(property="content", type="object")
* )
* )
* )
* )
*/
public function getEventosAgendasAction(Request $request, DescubrirBaService $descubrirBaService)
{
$statusCode = APIResponse::$SUCCESS;
$status = APIResponse::$SUCCESS;
$errors = array();
$result = null;
try {
$endpointAgrupador = CommonFunctions::getParameter('ENDPOINT_DESCUBRIR_BA_AGENDA');
$result = $descubrirBaService->getEventosAgendas($endpointAgrupador);
} catch (Exception $e) {
$statusCode = APIResponse::$INTERNAL_ERROR;
$status = APIResponse::$INTERNAL_ERROR;
$errors = array($e->getMessage());
$errorInfo = CommonFunctions::getErrorException($e);
$this->logInteractionService->addErrorLog(
LogInteraction::$LIST,
CommonFunctions::getClassMethod(__METHOD__),
$e->getMessage(),
$errorInfo
);
}
return $this->generateJsonResponse($result, $statusCode, $status, $errors);
}
}