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.     public function __construct(
  247.         int $id,
  248.         string $name,
  249.         string $regularPrice,
  250.         string $offerPrice,
  251.         string $discountPercent,
  252.         int $saleCount,
  253.         string $imageUrl,
  254.         string $verticalImageUrl,
  255.         string $activeTill,
  256.         float $rating,
  257.         string $companyLogoImage,
  258.         string $companyName,
  259.         int $offerType,
  260.         string $address,
  261.         int $visitCount,
  262.         int $numberOfPromocodesPerDay,
  263.         float $conversion,
  264.         array $shopImages,
  265.         array $images,
  266.         array $locations,
  267.         ?array $allowedOnlineOrderTypes,
  268.         ?string $partnerOnlineRegistrationLink,
  269.         array $paymentMethodsForOnlineOrder
  270.     ) {
  271.         $this->id $id;
  272.         $this->name $name;
  273.         $this->regularPrice $regularPrice;
  274.         $this->offerPrice $offerPrice;
  275.         $this->discountPercent $discountPercent;
  276.         $this->saleCount $saleCount;
  277.         $this->imageUrl $imageUrl;
  278.         $this->verticalImageUrl $verticalImageUrl;
  279.         $this->activeTill $activeTill;
  280.         $this->rating $rating;
  281.         $this->companyLogoImage $companyLogoImage;
  282.         $this->companyName $companyName;
  283.         $this->offerType $offerType;
  284.         $this->address $address;
  285.         $this->visitCount $visitCount;
  286.         $this->numberOfPromocodesPerDay $numberOfPromocodesPerDay;
  287.         $this->conversion $conversion;
  288.         $this->shopImages $shopImages;
  289.         $this->images $images;
  290.         $this->locations $locations;
  291.         $this->allowedOnlineOrderTypes $allowedOnlineOrderTypes;
  292.         $this->partnerOnlineRegistrationLink $partnerOnlineRegistrationLink;
  293.         $this->paymentMethodsForOnlineOrder $paymentMethodsForOnlineOrder;
  294.     }
  295.     public function getRating(): float
  296.     {
  297.         return $this->rating;
  298.     }
  299.     public function getSaleCount(): int
  300.     {
  301.         return $this->saleCount;
  302.     }
  303.     public function getLocations(): array
  304.     {
  305.         return $this->locations;
  306.     }
  307.     public function jsonSerialize(): array
  308.     {
  309.         return [
  310.             'ID' => $this->id,
  311.             'name' => $this->name,
  312.             'regularPrice' => $this->regularPrice,
  313.             'offerPrice' => $this->offerPrice,
  314.             'discountPercent' => $this->discountPercent,
  315.             'saleCount' => $this->saleCount,
  316.             'imageURL' => $this->imageUrl,
  317.             'verticalImageUrl' => $this->verticalImageUrl,
  318.             'activeTill' => $this->activeTill,
  319.             'rating' => $this->rating,
  320.             'companyLogoImage' => $this->companyLogoImage,
  321.             'companyName' => $this->companyName,
  322.             'offerType' => $this->offerType,
  323.             'address' => $this->address,
  324.             'visitCount' => $this->visitCount,
  325.             'numberOfPromocodesPerDay' => $this->numberOfPromocodesPerDay,
  326.             'conversion' => $this->conversion,
  327.             'shopImages' => $this->shopImages,
  328.             'images' => $this->images,
  329.             'locations' => $this->locations,
  330.             'allowedOnlineOrderTypes' => $this->allowedOnlineOrderTypes,
  331.             'partnerOnlineRegistrationLink' => $this->partnerOnlineRegistrationLink,
  332.             'paymentMethodsForOnlineOrder' => $this->paymentMethodsForOnlineOrder !== [] ? $this->paymentMethodsForOnlineOrder null,
  333.         ];
  334.     }
  335. }