wip: group inquiries and bookings
This commit is contained in:
1 parent
41424de151
commit
1a653726b4
115 files changed
+8107
-424
No files matched your search
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Entity\Groups\AccommodationBooking;
|
||||
use Symfony\Component\Serializer\Attribute\Context;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
|
||||
|
||||
final readonly class AccommodationBookingApiResponse
|
||||
{
|
||||
#[Groups(['api:single'])]
|
||||
public string $uuid;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public string $status;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
|
||||
public ?\DateTimeImmutable $dateFrom;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
#[Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])]
|
||||
public ?\DateTimeImmutable $dateTo;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public int $nights;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public int $paxCount;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public int $minorsCount;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public int $childrenCount;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public ?string $groupName;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public ?\DateTimeImmutable $acceptedAt;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public AccommodationBookingPersonalData $personalData;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public AccommodationBookingHotelInfo $accommodation;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public AccommodationBookingBoardServiceInfo $boardService;
|
||||
|
||||
/**
|
||||
* @var list<AccommodationBookingAdditionalServiceItem>
|
||||
*/
|
||||
#[Groups(['api:single'])]
|
||||
public array $additionalServices;
|
||||
|
||||
#[Groups(['api:single'])]
|
||||
public ?int $discount;
|
||||
|
||||
/**
|
||||
* @var array<string, mixed>|null
|
||||
*/
|
||||
#[Groups(['api:single'])]
|
||||
public ?array $priceBreakdown;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|null $priceBreakdown
|
||||
*/
|
||||
public function __construct(AccommodationBooking $booking, ?array $priceBreakdown)
|
||||
{
|
||||
$this->uuid = $booking->getUuid();
|
||||
$this->status = $booking->isInquiry() ? 'inquiry' : 'booking';
|
||||
$this->dateFrom = $booking->getDateFrom();
|
||||
$this->dateTo = $booking->getDateTo();
|
||||
$this->nights = $booking->getNights();
|
||||
$this->paxCount = $booking->getPaxCount();
|
||||
$this->minorsCount = $booking->getMinorsCount();
|
||||
$this->childrenCount = $booking->getChildrenCount();
|
||||
$this->groupName = $booking->getGroupName();
|
||||
$this->acceptedAt = $booking->getAcceptedAt();
|
||||
$this->personalData = new AccommodationBookingPersonalData($booking);
|
||||
$this->accommodation = new AccommodationBookingHotelInfo($booking->getAccommodation());
|
||||
$this->boardService = new AccommodationBookingBoardServiceInfo($booking);
|
||||
$this->additionalServices = array_map(
|
||||
static fn (array $service) => new AccommodationBookingAdditionalServiceItem($service),
|
||||
$booking->getAdditionalServices(),
|
||||
);
|
||||
$this->discount = $booking->getDiscount();
|
||||
$this->priceBreakdown = $priceBreakdown;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user