32 lines
819 B
PHP
32 lines
819 B
PHP
<?php
|
|
|
|
namespace Modules\ProjectManagement\Enums;
|
|
|
|
enum TaskStatus: string
|
|
{
|
|
case Pending = 'pending';
|
|
case InProgress = 'in_progress';
|
|
case Completed = 'completed';
|
|
case Blocked = 'blocked';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::Pending => 'Pending',
|
|
self::InProgress => 'In Progress',
|
|
self::Completed => 'Completed',
|
|
self::Blocked => 'Blocked',
|
|
};
|
|
}
|
|
|
|
public function allowedTransitions(): array
|
|
{
|
|
return match ($this) {
|
|
self::Pending => [self::InProgress, self::Blocked],
|
|
self::InProgress => [self::Completed, self::Blocked, self::Pending],
|
|
self::Completed => [],
|
|
self::Blocked => [self::Pending, self::InProgress],
|
|
};
|
|
}
|
|
}
|