src/Dto/WorkExample/WorkExampleWithAddressesDto.php line 12

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\Dto\WorkExample;
  4. use JsonSerializable;
  5. use OpenApi\Annotations as OA;
  6. use Nelmio\ApiDocBundle\Annotation\Model;
  7. use Slivki\Response\Beauty\Offer\MasterResponse;
  8. final class WorkExampleWithAddressesDto implements JsonSerializable
  9. {
  10.     /**
  11.      * @OA\Property(
  12.      *     description="Идентификатор примера работ",
  13.      *     example=6,
  14.      * )
  15.      */
  16.     private int $id;
  17.     /**
  18.      * @OA\Property(
  19.      *     property="offerId",
  20.      *     description="Идентификатор акции",
  21.      *     example=132242,
  22.      * )
  23.      */
  24.     private int $offerId;
  25.     /**
  26.      * @OA\Property(
  27.      *     property="offerUrl",
  28.      *     description="Ссылка на акцию",
  29.      *     example="https://www.slivki.by/kombinirovannaya-chistka-lica-minsk-skidka-marsel",
  30.      * )
  31.      */
  32.     private string $offerUrl;
  33.     /**
  34.      * @var array<WorkExampleAddressWithDistanceDto>
  35.      *
  36.      * @OA\Property(
  37.      *     type="array",
  38.      *     description="Адреса с расстояниями до них",
  39.      *     @OA\Items(ref=@Model(type=WorkExampleAddressWithDistanceDto::class)),
  40.      * )
  41.      */
  42.     private array $addresses;
  43.     /**
  44.      * @OA\Property(
  45.      *     property="beautyMaster",
  46.      *     description="Мастер",
  47.      *     type="object",
  48.      *     ref=@Model(type=MasterResponse::class),
  49.      * )
  50.      */
  51.     private ?MasterResponse $beautyMaster;
  52.     /**
  53.      * @OA\Property(
  54.      *     property="imageUrl",
  55.      *     description="Ссылка на изображение",
  56.      *     example="https://www.slivki.by/znijki-media/initial/work-example/image.jpg",
  57.      *     nullable=true,
  58.      * )
  59.      */
  60.     private ?string $imageUrl;
  61.     /**
  62.      * @OA\Property(
  63.      *     description="Описание",
  64.      *     example="Маникюр с долговременным покрытием",
  65.      *     nullable=true,
  66.      * )
  67.      */
  68.     private ?string $description;
  69.     /**
  70.      * @OA\Property(
  71.      *     description="Цена",
  72.      *     example=123.45,
  73.      *     nullable=true,
  74.      * )
  75.      */
  76.     private ?float $price;
  77.     public function __construct(
  78.         int $id,
  79.         int $offerId,
  80.         string $offerUrl,
  81.         array $addresses,
  82.         ?MasterResponse $beautyMaster,
  83.         ?string $imageUrl,
  84.         ?string $description,
  85.         ?float $price
  86.     ) {
  87.         $this->id $id;
  88.         $this->offerId $offerId;
  89.         $this->price $price;
  90.         $this->offerUrl $offerUrl;
  91.         $this->imageUrl $imageUrl;
  92.         $this->description $description;
  93.         $this->addresses $addresses;
  94.         $this->beautyMaster $beautyMaster;
  95.     }
  96.     public function jsonSerialize(): array
  97.     {
  98.         return [
  99.             'id' => $this->id,
  100.             'offerId' => $this->offerId,
  101.             'price' => $this->price,
  102.             'offerUrl' => $this->offerUrl,
  103.             'imageUrl' => $this->imageUrl,
  104.             'description' => $this->description,
  105.             'addresses' => $this->addresses,
  106.             'beautyMaster' => $this->beautyMaster,
  107.         ];
  108.     }
  109. }