feat(fer-19) : dto PontBasculeHealth
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
60
src/Dto/PontBasculeHealth.php
Normal file
60
src/Dto/PontBasculeHealth.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Dto;
|
||||||
|
|
||||||
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
|
||||||
|
final readonly class PontBasculeHealth
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private bool $healthy,
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private bool $ok = false,
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private bool $busy = false,
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private bool $portConnected = false,
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private ?string $portError = null,
|
||||||
|
#[Groups(['pont_bascule:health:read'])]
|
||||||
|
private ?string $hostname = null,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public static function unhealthy(): self
|
||||||
|
{
|
||||||
|
return new self(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isHealthy(): bool
|
||||||
|
{
|
||||||
|
return $this->healthy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isOk(): bool
|
||||||
|
{
|
||||||
|
return $this->ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isBusy(): bool
|
||||||
|
{
|
||||||
|
return $this->busy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPortConnected(): bool
|
||||||
|
{
|
||||||
|
return $this->portConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPortError(): ?string
|
||||||
|
{
|
||||||
|
return $this->portError;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHostname(): ?string
|
||||||
|
{
|
||||||
|
return $this->hostname;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user