src/BusinessFeature/Yclients/Dto/AppointmentDto.php line 11

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Slivki\BusinessFeature\Yclients\Dto;
  4. use OpenApi\Annotations as OA;
  5. use Nelmio\ApiDocBundle\Annotation\Model;
  6. use JsonSerializable;
  7. final class AppointmentDto implements JsonSerializable
  8. {
  9.     /**
  10.      * @OA\Property(
  11.      *     property="service",
  12.      *     type="object",
  13.      *     ref=@Model(type=ServiceDto::class),
  14.      *     description="Услуга",
  15.      * ),
  16.      *
  17.      * @var ServiceDto
  18.      */
  19.     private ServiceDto $service;
  20.     /**
  21.      * @OA\Property(
  22.      *     property="times",
  23.      *     type="array",
  24.      *     @OA\Items(
  25.      *         type="string",
  26.      *         example="10:00",
  27.      *         description="Время",
  28.      *     ),
  29.      *     description="Время",
  30.      * ),
  31.      *
  32.      * @var array
  33.      */
  34.     private array $times;
  35.     /**
  36.      * @OA\Property(
  37.      *     property="location",
  38.      *     type="object",
  39.      *     ref=@Model(type=LocationDto::class),
  40.      *     description="Локация",
  41.      * ),
  42.      *
  43.      * @var LocationDto
  44.      */
  45.     private LocationDto $location;
  46.     /**
  47.      *  @OA\Property(
  48.      *      property="externalTimes",
  49.      *      description="Время с ссылкой на внешний ресурс",
  50.      *      type="array",
  51.      *      @OA\Items(ref=@Model(type=TimeDto::class)),
  52.      *  )
  53.      *
  54.      * @var array<TimeDto>
  55.      */
  56.     private array $externalTimes;
  57.     public function __construct(
  58.         ServiceDto $service,
  59.         array $times,
  60.         LocationDto $location,
  61.         array $externalTimes = []
  62.     ) {
  63.         $this->service $service;
  64.         $this->times $times;
  65.         $this->location $location;
  66.         $this->externalTimes $externalTimes;
  67.     }
  68.     public function jsonSerialize(): array
  69.     {
  70.         return [
  71.             'service' => $this->service,
  72.             'times' => $this->times,
  73.             'location' => $this->location,
  74.             'externalTimes' => $this->externalTimes,
  75.         ];
  76.     }
  77. }