41 lines
911 B
PHP
41 lines
911 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Onboarding;
|
|
|
|
enum OnboardingDraftStatus: string
|
|
{
|
|
case Draft = 'draft';
|
|
case Completed = 'completed';
|
|
case Cancelled = 'cancelled';
|
|
|
|
public static function fromLifecycleState(OnboardingLifecycleState $state): self
|
|
{
|
|
return match ($state) {
|
|
OnboardingLifecycleState::Completed => self::Completed,
|
|
OnboardingLifecycleState::Cancelled => self::Cancelled,
|
|
default => self::Draft,
|
|
};
|
|
}
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::Draft => 'Draft',
|
|
self::Completed => 'Completed',
|
|
self::Cancelled => 'Cancelled',
|
|
};
|
|
}
|
|
|
|
public function isResumable(): bool
|
|
{
|
|
return $this === self::Draft;
|
|
}
|
|
|
|
public function isTerminal(): bool
|
|
{
|
|
return ! $this->isResumable();
|
|
}
|
|
}
|