50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Filament\Support\Contracts\HasColor;
|
|
use Filament\Support\Contracts\HasIcon;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
enum ResponseStatus: string implements HasColor, HasIcon, HasLabel
|
|
{
|
|
case CacheHit = 'cache_hit';
|
|
case ApiFetched = 'api_fetched';
|
|
case NotFound = 'not_found';
|
|
case Error = 'error';
|
|
case ContactSubmitted = 'contact_submitted';
|
|
|
|
public function getLabel(): string
|
|
{
|
|
return match ($this) {
|
|
self::CacheHit => 'Cache Hit',
|
|
self::ApiFetched => 'API Fetched',
|
|
self::NotFound => 'Not Found',
|
|
self::Error => 'Error',
|
|
self::ContactSubmitted => 'Contact Submitted',
|
|
};
|
|
}
|
|
|
|
public function getColor(): string
|
|
{
|
|
return match ($this) {
|
|
self::CacheHit => 'success',
|
|
self::ApiFetched => 'info',
|
|
self::NotFound => 'warning',
|
|
self::Error => 'danger',
|
|
self::ContactSubmitted => 'primary',
|
|
};
|
|
}
|
|
|
|
public function getIcon(): string
|
|
{
|
|
return match ($this) {
|
|
self::CacheHit => 'heroicon-m-check-circle',
|
|
self::ApiFetched => 'heroicon-m-cloud-arrow-down',
|
|
self::NotFound => 'heroicon-m-magnifying-glass',
|
|
self::Error => 'heroicon-m-x-circle',
|
|
self::ContactSubmitted => 'heroicon-m-envelope',
|
|
};
|
|
}
|
|
}
|