<?php
declare(strict_types=1);
namespace Slivki\Dto\WorkExample;
use JsonSerializable;
use OpenApi\Annotations as OA;
final class WorkExampleAddressWithDistanceDto implements JsonSerializable
{
/**
* @OA\Property(
* description="Идентификатор локации",
* example=12345,
* )
*/
private int $id;
/**
* @OA\Property(
* description="Адрес",
* example="г. Минск, ул. Захарова, д. 23",
* )
*/
private string $address;
/**
* @OA\Property(
* description="Рассстояние от пользователя в метрах",
* example=6123,
* nullable=true,
* )
*/
private ?int $distance;
public function __construct(int $id, string $address, ?int $distance)
{
$this->id = $id;
$this->address = $address;
$this->distance = $distance;
}
public function jsonSerialize(): array
{
return [
'id' => $this->id,
'address' => $this->address,
'distance' => $this->distance,
];
}
}