__( 'Pending', 'shiftora' ), self::Running => __( 'Running', 'shiftora' ), self::Paused => __( 'Paused', 'shiftora' ), self::Cancelling => __( 'Canceling', 'shiftora' ), self::Completed => __( 'Completed', 'shiftora' ), self::Failed => __( 'Failed', 'shiftora' ), self::Recovered => __( 'Restored', 'shiftora' ), self::Cancelled => __( 'Canceled', 'shiftora' ), }; } /** * Returns whether the migration is in a terminal state. */ public function is_terminal(): bool { return in_array( $this, [ self::Completed, self::Failed, self::Recovered, self::Cancelled ], true ); } /** * Every terminal status as a string, for callers holding a database value. * * @return string[] */ public static function terminal_values(): array { return array_map( static fn( self $status ): string => $status->value, [ self::Completed, self::Failed, self::Recovered, self::Cancelled ] ); } /** * Returns the CSS badge variant for this status. */ public function badge_variant(): string { return match ( $this ) { self::Pending => 'neutral', self::Running => 'info', self::Paused => 'warning', self::Cancelling => 'warning', self::Completed => 'success', self::Failed => 'danger', self::Recovered => 'warning', self::Cancelled => 'neutral', }; } }