<?php
declare(strict_types=1);
namespace Slivki\Dto\WorkExample;
use JsonSerializable;
use OpenApi\Annotations as OA;
use Nelmio\ApiDocBundle\Annotation\Model;
use Slivki\Response\Beauty\Offer\MasterResponse;
final class WorkExampleWithAddressesDto implements JsonSerializable
{
/**
* @OA\Property(
* description="Идентификатор примера работ",
* example=6,
* )
*/
private int $id;
/**
* @OA\Property(
* property="offerId",
* description="Идентификатор акции",
* example=132242,
* )
*/
private int $offerId;
/**
* @OA\Property(
* property="offerUrl",
* description="Ссылка на акцию",
* example="https://www.slivki.by/kombinirovannaya-chistka-lica-minsk-skidka-marsel",
* )
*/
private string $offerUrl;
/**
* @var array<WorkExampleAddressWithDistanceDto>
*
* @OA\Property(
* type="array",
* description="Адреса с расстояниями до них",
* @OA\Items(ref=@Model(type=WorkExampleAddressWithDistanceDto::class)),
* )
*/
private array $addresses;
/**
* @OA\Property(
* property="beautyMaster",
* description="Мастер",
* type="object",
* ref=@Model(type=MasterResponse::class),
* )
*/
private ?MasterResponse $beautyMaster;
/**
* @OA\Property(
* property="imageUrl",
* description="Ссылка на изображение",
* example="https://www.slivki.by/znijki-media/initial/work-example/image.jpg",
* nullable=true,
* )
*/
private ?string $imageUrl;
/**
* @OA\Property(
* description="Описание",
* example="Маникюр с долговременным покрытием",
* nullable=true,
* )
*/
private ?string $description;
/**
* @OA\Property(
* description="Цена",
* example=123.45,
* nullable=true,
* )
*/
private ?float $price;
public function __construct(
int $id,
int $offerId,
string $offerUrl,
array $addresses,
?MasterResponse $beautyMaster,
?string $imageUrl,
?string $description,
?float $price
) {
$this->id = $id;
$this->offerId = $offerId;
$this->price = $price;
$this->offerUrl = $offerUrl;
$this->imageUrl = $imageUrl;
$this->description = $description;
$this->addresses = $addresses;
$this->beautyMaster = $beautyMaster;
}
public function jsonSerialize(): array
{
return [
'id' => $this->id,
'offerId' => $this->offerId,
'price' => $this->price,
'offerUrl' => $this->offerUrl,
'imageUrl' => $this->imageUrl,
'description' => $this->description,
'addresses' => $this->addresses,
'beautyMaster' => $this->beautyMaster,
];
}
}