<?php
declare(strict_types=1);
namespace Slivki\Response\Offer\Location;
use JsonSerializable;
use OpenApi\Annotations as OA;
use Slivki\ValueObject\Coordinate;
use function sprintf;
final class OfferLocationResponse implements JsonSerializable
{
/**
* @OA\Property(
* property="phoneNumbers",
* type="array",
* @OA\Items(
* type="string",
* ),
* description="Номера телефонов",
* ),
*
* @var array
*/
private array $phoneNumbers;
/**
* @OA\Property(
* property="coordinate",
* type="string",
* description="Геолокация",
* ),
*
* @var Coordinate
*/
private Coordinate $coordinate;
/**
* @OA\Property(
* property="address",
* type="string",
* description="Адрес",
* ),
*
* @var string
*/
private string $address;
/**
* @OA\Property(
* property="workingHours",
* type="string",
* description="Рабочие часы",
* ),
*
* @var string|null
*/
private ?string $workingHours;
/**
* @OA\Property(
* property="description",
* type="string",
* description="Описание",
* ),
*
* @var string|null
*/
private ?string $description;
public function __construct(
array $phoneNumbers,
Coordinate $coordinate,
string $address,
?string $workingHours,
?string $description
) {
$this->phoneNumbers = $phoneNumbers;
$this->coordinate = $coordinate;
$this->address = $address;
$this->workingHours = $workingHours;
$this->description = $description;
}
public function getCoordinate(): Coordinate
{
return $this->coordinate;
}
public function jsonSerialize(): array
{
return [
'phoneNumbers' => $this->phoneNumbers,
'geoLocation' => [sprintf('%s,%s', $this->coordinate->getLatitude(), $this->coordinate->getLongitude())],
'address' => $this->address,
'workingHours' => $this->workingHours,
'description' => $this->description,
];
}
}