37 lines
960 B
PHP
37 lines
960 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\BusProNet\Model;
|
|
|
|
/**
|
|
* Represents service availability with status and pricing information.
|
|
*
|
|
* This class handles availability data including service identification,
|
|
* status, available quantity, and pricing. It implements JsonSerializable
|
|
* for API response formatting.
|
|
*/
|
|
class Availability implements \JsonSerializable
|
|
{
|
|
public ?int $serviceId = null;
|
|
public ?string $status = null;
|
|
public ?int $available = null;
|
|
public ?float $price = null;
|
|
|
|
/**
|
|
* Serializes the availability data to JSON format.
|
|
*
|
|
* Converts the availability object to an array structure suitable
|
|
* for JSON serialization in API responses.
|
|
*
|
|
* @return array<string, mixed> The serialized availability data
|
|
*/
|
|
public function jsonSerialize(): array
|
|
{
|
|
return [
|
|
'id' => $this->serviceId,
|
|
'available' => $this->available,
|
|
];
|
|
}
|
|
}
|