88 lines
2.6 KiB
PHP
88 lines
2.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Form\Model;
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
class AccommodationBookingDto
|
|
{
|
|
public int $currentStep = 1;
|
|
|
|
public ?int $accommodationId = null;
|
|
|
|
public ?\DateTimeImmutable $dateFrom = null;
|
|
|
|
public ?\DateTimeImmutable $dateTo = null;
|
|
|
|
#[Assert\Positive(message: 'invalid', groups: ['step_3'])]
|
|
public int $paxCount = 1;
|
|
|
|
#[Assert\PositiveOrZero(message: 'invalid', groups: ['step_3'])]
|
|
public int $minorsCount = 0;
|
|
|
|
#[Assert\PositiveOrZero(message: 'invalid', groups: ['step_3'])]
|
|
public int $childrenCount = 0;
|
|
|
|
#[Assert\NotNull(message: 'required', groups: ['step_2'])]
|
|
public ?int $selectedBoardServiceId = null;
|
|
|
|
/** @var list<int> */
|
|
public array $selectedAdditionalServiceIds = [];
|
|
|
|
public bool $isInquiry = false;
|
|
|
|
/** @var string[] */
|
|
public array $inquiryReasons = [];
|
|
|
|
public bool $forceInquiry = false;
|
|
|
|
public ?int $totalPrice = null;
|
|
|
|
/** @var array<string, mixed> */
|
|
public array $priceBreakdown = [];
|
|
|
|
// `contact` is the subset an office-made offer is checked against before the customer
|
|
// may accept it — the same constraints the customer meets in step 3 of a self-service booking.
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $groupName = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
#[Assert\Choice(choices: ['Herr', 'Frau', 'divers'], groups: ['step_3', 'contact'])]
|
|
public ?string $salutation = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $firstName = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $lastName = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
#[Assert\Email(message: 'invalid', groups: ['step_3', 'contact'])]
|
|
public ?string $email = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $phone = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $street = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $zip = null;
|
|
|
|
#[Assert\NotBlank(message: 'required', groups: ['step_3', 'contact'])]
|
|
public ?string $city = null;
|
|
|
|
public ?string $remarks = null;
|
|
|
|
public function getNights(): int
|
|
{
|
|
if (null === $this->dateFrom || null === $this->dateTo) {
|
|
return 0;
|
|
}
|
|
|
|
return $this->dateFrom->diff($this->dateTo)->days;
|
|
}
|
|
}
|