53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class RsvReservationTypeConfigurationStep {
|
||
|
|
public int $index;
|
||
|
|
|
||
|
|
public string $type;
|
||
|
|
|
||
|
|
public array|null $configuration;
|
||
|
|
|
||
|
|
public function __construct(array $data) {
|
||
|
|
$this->index = $data['index'];
|
||
|
|
$this->type = $data['type'];
|
||
|
|
$this->configuration = $data['configuration'] ?? null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class RsvReservationTypeConfiguration {
|
||
|
|
public array $steps = [];
|
||
|
|
|
||
|
|
public function __construct(array $data) {
|
||
|
|
$this->steps = [];
|
||
|
|
foreach( $data['steps'] as $step ) {
|
||
|
|
array_push( $this->steps, new RsvReservationTypeConfigurationStep($step) );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
class RsvReservationType {
|
||
|
|
public int $id;
|
||
|
|
|
||
|
|
public string $name;
|
||
|
|
|
||
|
|
public string $description;
|
||
|
|
|
||
|
|
public $configuration;
|
||
|
|
|
||
|
|
public function __construct(array $data) {
|
||
|
|
$this->id = $data['id'];
|
||
|
|
$this->name = $data['name'];
|
||
|
|
$this->description = $data['description'];
|
||
|
|
$this->configuration = json_decode($data['configuration'], true);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function to_array() {
|
||
|
|
return [
|
||
|
|
'id' => $this->id,
|
||
|
|
'name' => $this->name,
|
||
|
|
'description' => $this->description,
|
||
|
|
'configuration' => json_encode($this->configuration)
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|