src/Response/User/Favorite/GetUserFavoriteOffersResponse.php line 12

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Response\User\Favorite;
  4. use Nelmio\ApiDocBundle\Annotation\Model;
  5. use OpenApi\Annotations as OA;
  6. use JsonSerializable;
  7. use Slivki\Response\Offer\Location\OfferLocationResponse;
  8. final class GetUserFavoriteOffersResponse implements JsonSerializable
  9. {
  10.     /**
  11.      * @OA\Property(
  12.      *     property="ID",
  13.      *     type="integer",
  14.      *     description="ID",
  15.      * ),
  16.      *
  17.      * @var int
  18.      */
  19.     private int $id;
  20.     /**
  21.      * @OA\Property(
  22.      *     property="name",
  23.      *     type="string",
  24.      *     description="Название",
  25.      * ),
  26.      *
  27.      * @var string
  28.      */
  29.     private string $name;
  30.     /**
  31.      * @OA\Property(
  32.      *     property="regularPrice",
  33.      *     type="string",
  34.      *     description="Обычная цена",
  35.      * ),
  36.      *
  37.      * @var string
  38.      */
  39.     private string $regularPrice;
  40.     /**
  41.      * @OA\Property(
  42.      *     property="offerPrice",
  43.      *     type="string",
  44.      *     description="Цена по акции",
  45.      * ),
  46.      *
  47.      * @var string
  48.      */
  49.     private string $offerPrice;
  50.     /**
  51.      * @OA\Property(
  52.      *     property="discountPercent",
  53.      *     type="string",
  54.      *     description="Процент скидки",
  55.      * ),
  56.      *
  57.      * @var string
  58.      */
  59.     private string $discountPercent;
  60.     /**
  61.      * @OA\Property(
  62.      *     property="saleCount",
  63.      *     type="integer",
  64.      *     description="Количество продаж",
  65.      * ),
  66.      *
  67.      * @var int
  68.      */
  69.     private int $saleCount;
  70.     /**
  71.      * @OA\Property(
  72.      *     property="imageURL",
  73.      *     type="string",
  74.      *     description="URL изображения",
  75.      * ),
  76.      *
  77.      * @var string
  78.      */
  79.     private string $imageUrl;
  80.     /**
  81.      * @OA\Property(
  82.      *     property="verticalImageUrl",
  83.      *     type="string",
  84.      *     description="Вертикальное изображение",
  85.      * ),
  86.      *
  87.      * @var string
  88.      */
  89.     private string $verticalImageUrl;
  90.     /**
  91.      * @OA\Property(
  92.      *     property="activeTill",
  93.      *     type="string",
  94.      *     description="Активно до",
  95.      * ),
  96.      *
  97.      * @var string
  98.      */
  99.     private string $activeTill;
  100.     /**
  101.      * @OA\Property(
  102.      *     property="rating",
  103.      *     type="number",
  104.      *     description="Рейтинг",
  105.      * ),
  106.      *
  107.      * @var float
  108.      */
  109.     private float $rating;
  110.     /**
  111.      * @OA\Property(
  112.      *     property="companyLogoImage",
  113.      *     type="string",
  114.      *     description="Логотип компании",
  115.      * ),
  116.      *
  117.      * @var string
  118.      */
  119.     private string $companyLogoImage;
  120.     /**
  121.      * @OA\Property(
  122.      *     property="companyName",
  123.      *     type="string",
  124.      *     description="Название компании",
  125.      * ),
  126.      *
  127.      * @var string
  128.      */
  129.     private string $companyName;
  130.     /**
  131.      * @OA\Property(
  132.      *     property="offerType",
  133.      *     type="integer",
  134.      *     description="Тип акции",
  135.      * ),
  136.      *
  137.      * @var int
  138.      */
  139.     private int $offerType;
  140.     /**
  141.      * @OA\Property(
  142.      *     property="address",
  143.      *     type="string",
  144.      *     description="Адрес",
  145.      * ),
  146.      *
  147.      * @var string
  148.      */
  149.     private string $address;
  150.     /**
  151.      * @OA\Property(
  152.      *     property="visitCount",
  153.      *     type="integer",
  154.      *     description="Количество посещений",
  155.      * ),
  156.      *
  157.      * @var int
  158.      */
  159.     private int $visitCount;
  160.     /**
  161.      * @OA\Property(
  162.      *     property="numberOfPromocodesPerDay",
  163.      *     type="integer",
  164.      *     description="Количество промокодов в день",
  165.      * ),
  166.      *
  167.      * @var int
  168.      */
  169.     private int $numberOfPromocodesPerDay;
  170.     /**
  171.      * @OA\Property(
  172.      *     property="conversion",
  173.      *     type="number",
  174.      *     description="Конверсия",
  175.      * ),
  176.      *
  177.      * @var float
  178.      */
  179.     private float $conversion;
  180.     /**
  181.      * @OA\Property(
  182.      *     property="shopImages",
  183.      *     type="array",
  184.      *     @OA\Items(type="string"),
  185.      *     description="Изображения магазина",
  186.      * ),
  187.      *
  188.      * @var array<string>
  189.      */
  190.     private array $shopImages;
  191.     /**
  192.      * @OA\Property(
  193.      *     property="images",
  194.      *     type="array",
  195.      *     @OA\Items(type="string"),
  196.      *     description="Изображения",
  197.      * ),
  198.      *
  199.      * @var array<string>
  200.      */
  201.     private array $images;
  202.     /**
  203.      * @OA\Property(
  204.      *     property="locations",
  205.      *     type="array",
  206.      *     @OA\Items(ref=@Model(type=OfferLocationResponse::class)),
  207.      *     description="Локации",
  208.      * ),
  209.      *
  210.      * @var array<OfferLocationResponse>
  211.      */
  212.     private array $locations;
  213.     /**
  214.      * @OA\Property(
  215.      *     property="allowedOnlineOrderTypes",
  216.      *     type="array",
  217.      *     @OA\Items(type="string"),
  218.      *     description="Типы онлайн заказов",
  219.      * ),
  220.      *
  221.      * @var array<string>|null
  222.      */
  223.     private ?array $allowedOnlineOrderTypes;
  224.     /**
  225.      * @OA\Property(
  226.      *     property="partnerOnlineRegistrationLink",
  227.      *     type="string",
  228.      *     description="Ссылка на регистрацию партнера онлайн",
  229.      * ),
  230.      *
  231.      * @var string|null
  232.      */
  233.     private ?string $partnerOnlineRegistrationLink;
  234.     /**
  235.      * @OA\Property(
  236.      *     property="paymentMethodsForOnlineOrder",
  237.      *     nullable=true,
  238.      *     type="array",
  239.      *     @OA\Items(type="string"),
  240.      *     description="Методы оплаты для онлайн заказа",
  241.      * ),
  242.      *
  243.      * @var array<string>
  244.      */
  245.     private array $paymentMethodsForOnlineOrder;
  246.     /**
  247.      * @OA\Property(
  248.      *     property="isVisible",
  249.      *     type="boolean",
  250.      *     description="Видимость",
  251.      * ),
  252.      */
  253.     private bool $isVisible;
  254.     /**
  255.      * @OA\Property(
  256.      *     property="telegram",
  257.      *     type="string",
  258.      *     description="Telegram",
  259.      *     example="37529000000",
  260.      * ),
  261.      *
  262.      * @var string|null
  263.      */
  264.     private ?string $telegram;
  265.     /**
  266.      * @OA\Property(
  267.      *     property="viber",
  268.      *     type="string",
  269.      *     description="Viber",
  270.      *     example="37529000000",
  271.      * ),
  272.      *
  273.      * @var string|null
  274.      */
  275.     private ?string $viber;
  276.     /**
  277.      * @OA\Property(
  278.      *     property="isWithoutCodes",
  279.      *     type="boolean",
  280.      *     description="Акция без промокодов",
  281.      * ),
  282.      *
  283.      * @var bool
  284.      */
  285.     private bool $isWithoutCodes;
  286.     public function __construct(
  287.         int $id,
  288.         string $name,
  289.         string $regularPrice,
  290.         string $offerPrice,
  291.         string $discountPercent,
  292.         int $saleCount,
  293.         string $imageUrl,
  294.         string $verticalImageUrl,
  295.         string $activeTill,
  296.         float $rating,
  297.         string $companyLogoImage,
  298.         string $companyName,
  299.         int $offerType,
  300.         string $address,
  301.         int $visitCount,
  302.         int $numberOfPromocodesPerDay,
  303.         float $conversion,
  304.         array $shopImages,
  305.         array $images,
  306.         array $locations,
  307.         ?array $allowedOnlineOrderTypes,
  308.         ?string $partnerOnlineRegistrationLink,
  309.         array $paymentMethodsForOnlineOrder,
  310.         bool $isVisible,
  311.         ?string $telegram,
  312.         ?string $viber,
  313.         bool $isWithoutCodes
  314.     ) {
  315.         $this->id $id;
  316.         $this->name $name;
  317.         $this->regularPrice $regularPrice;
  318.         $this->offerPrice $offerPrice;
  319.         $this->discountPercent $discountPercent;
  320.         $this->saleCount $saleCount;
  321.         $this->imageUrl $imageUrl;
  322.         $this->verticalImageUrl $verticalImageUrl;
  323.         $this->activeTill $activeTill;
  324.         $this->rating $rating;
  325.         $this->companyLogoImage $companyLogoImage;
  326.         $this->companyName $companyName;
  327.         $this->offerType $offerType;
  328.         $this->address $address;
  329.         $this->visitCount $visitCount;
  330.         $this->numberOfPromocodesPerDay $numberOfPromocodesPerDay;
  331.         $this->conversion $conversion;
  332.         $this->shopImages $shopImages;
  333.         $this->images $images;
  334.         $this->locations $locations;
  335.         $this->allowedOnlineOrderTypes $allowedOnlineOrderTypes;
  336.         $this->partnerOnlineRegistrationLink $partnerOnlineRegistrationLink;
  337.         $this->paymentMethodsForOnlineOrder $paymentMethodsForOnlineOrder;
  338.         $this->isVisible $isVisible;
  339.         $this->telegram $telegram;
  340.         $this->viber $viber;
  341.         $this->isWithoutCodes $isWithoutCodes;
  342.     }
  343.     public function getRating(): float
  344.     {
  345.         return $this->rating;
  346.     }
  347.     public function getSaleCount(): int
  348.     {
  349.         return $this->saleCount;
  350.     }
  351.     public function getLocations(): array
  352.     {
  353.         return $this->locations;
  354.     }
  355.     public function isVisible(): bool
  356.     {
  357.         return $this->isVisible;
  358.     }
  359.     public function isWithoutCodes(): bool
  360.     {
  361.         return $this->isWithoutCodes;
  362.     }
  363.     public function jsonSerialize(): array
  364.     {
  365.         return [
  366.             'ID' => $this->id,
  367.             'name' => $this->name,
  368.             'regularPrice' => $this->regularPrice,
  369.             'offerPrice' => $this->offerPrice,
  370.             'discountPercent' => $this->discountPercent,
  371.             'saleCount' => $this->saleCount,
  372.             'imageURL' => $this->imageUrl,
  373.             'verticalImageUrl' => $this->verticalImageUrl,
  374.             'activeTill' => $this->activeTill,
  375.             'rating' => $this->rating,
  376.             'companyLogoImage' => $this->companyLogoImage,
  377.             'companyName' => $this->companyName,
  378.             'offerType' => $this->offerType,
  379.             'address' => $this->address,
  380.             'visitCount' => $this->visitCount,
  381.             'numberOfPromocodesPerDay' => $this->numberOfPromocodesPerDay,
  382.             'conversion' => $this->conversion,
  383.             'shopImages' => $this->shopImages,
  384.             'images' => $this->images,
  385.             'locations' => $this->locations,
  386.             'allowedOnlineOrderTypes' => $this->allowedOnlineOrderTypes,
  387.             'partnerOnlineRegistrationLink' => $this->partnerOnlineRegistrationLink,
  388.             'paymentMethodsForOnlineOrder' => $this->paymentMethodsForOnlineOrder !== [] ? $this->paymentMethodsForOnlineOrder null,
  389.             'isVisible' => $this->isVisible,
  390.             'telegram' => $this->telegram,
  391.             'viber' => $this->viber,
  392.             'isWithoutCodes' => $this->isWithoutCodes,
  393.         ];
  394.     }
  395. }