27 lines
1013 B
PHP
27 lines
1013 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Badges\Domains;
|
|
|
|
use App\Support\Alerts\AlertDestinationLastTestStatusEnum;
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeMapper;
|
|
use App\Support\Badges\BadgeSpec;
|
|
|
|
final class AlertDestinationLastTestStatusBadge implements BadgeMapper
|
|
{
|
|
public function spec(mixed $value): BadgeSpec
|
|
{
|
|
$state = BadgeCatalog::normalizeState($value);
|
|
|
|
return match ($state) {
|
|
AlertDestinationLastTestStatusEnum::Never->value => new BadgeSpec('Never', 'gray', 'heroicon-m-minus-circle'),
|
|
AlertDestinationLastTestStatusEnum::Sent->value => new BadgeSpec('Sent', 'success', 'heroicon-m-check-circle'),
|
|
AlertDestinationLastTestStatusEnum::Failed->value => new BadgeSpec('Failed', 'danger', 'heroicon-m-x-circle'),
|
|
AlertDestinationLastTestStatusEnum::Pending->value => new BadgeSpec('Pending', 'warning', 'heroicon-m-clock'),
|
|
default => BadgeSpec::unknown(),
|
|
};
|
|
}
|
|
}
|