Files
thecrimesynticate/app/Enums/CharacterStatus.php
T
2026-06-27 14:38:18 +03:00

54 lines
1.1 KiB
PHP

<?php
namespace App\Enums;
enum CharacterStatus: string
{
case ACTIVE = 'active';
case IN_HOSPITAL = 'in_hospital';
case IN_JAIL = 'in_jail';
case DEAD = 'dead';
/**
* Get all status values as an array
*/
public static function values(): array
{
return array_column(self::cases(), 'value');
}
/**
* Get the display name for a status
*/
public function label(): string
{
return match($this) {
self::ACTIVE => 'Active',
self::IN_HOSPITAL => 'In Hospital',
self::IN_JAIL => 'In Jail',
self::DEAD => 'Dead',
};
}
/**
* Check if character can perform actions
*/
public function canAct(): bool
{
return $this === self::ACTIVE;
}
/**
* Get the color class for the status badge
*/
public function color(): string
{
return match($this) {
self::ACTIVE => 'bg-green-500',
self::IN_HOSPITAL => 'bg-red-500',
self::IN_JAIL => 'bg-yellow-500',
self::DEAD => 'bg-gray-500',
};
}
}