getAllowedTransitions(), true); } /** * Get all allowed transitions from current status. * * @return array */ public function getAllowedTransitions(): array { return match ($this) { self::PENDING => [self::RUNNING, self::CANCELLED], self::RUNNING => [self::COMPLETED, self::FAILED, self::CANCELLED], self::COMPLETED => [], self::FAILED => [self::PENDING], // Allow retry self::CANCELLED => [], }; } /** * Check if this is a terminal (final) status. */ public function isTerminal(): bool { return in_array($this, [self::COMPLETED, self::FAILED, self::CANCELLED], true); } /** * Check if pipeline is currently processing. */ public function isActive(): bool { return $this === self::RUNNING; } /** * Check if pipeline can be retried. */ public function canRetry(): bool { return $this === self::FAILED; } /** * Get human-readable label. */ public function label(): string { return match ($this) { self::PENDING => 'Wartend', self::RUNNING => 'Läuft', self::COMPLETED => 'Abgeschlossen', self::FAILED => 'Fehlgeschlagen', self::CANCELLED => 'Abgebrochen', }; } /** * Get CSS class for badge styling. */ public function badgeClass(): string { return match ($this) { self::PENDING => 'pending', self::RUNNING => 'info', self::COMPLETED => 'completed', self::FAILED => 'failed', self::CANCELLED => 'warning', }; } }