<?php

declare(strict_types=1);

namespace Drupal\flowdrop_pipeline\Constants;

/**
 * Status constants for the FlowDrop Pipeline entity.
 *
 * Pipeline status lifecycle:
 * - PENDING: Initial state when pipeline is created (not yet started).
 * - RUNNING: Pipeline is currently executing jobs.
 * - COMPLETED: All jobs finished successfully.
 * - FAILED: Pipeline execution failed.
 * - CANCELLED: Pipeline was explicitly cancelled.
 * - PAUSED: Pipeline execution is paused.
 *
 * @internal
 */
final class PipelineStatus {

  public const PENDING = 'pending';

  public const RUNNING = 'running';

  public const COMPLETED = 'completed';

  public const FAILED = 'failed';

  public const CANCELLED = 'cancelled';

  public const PAUSED = 'paused';

  /**
   * Returns all allowed values keyed by machine name.
   *
   * Suitable for use in Drupal base field 'allowed_values' settings.
   *
   * @return array<string, string>
   *   Map of machine name to human-readable label.
   */
  public static function allowedValues(): array {
    return [
      self::PENDING => 'Pending',
      self::RUNNING => 'Running',
      self::COMPLETED => 'Completed',
      self::FAILED => 'Failed',
      self::CANCELLED => 'Cancelled',
      self::PAUSED => 'Paused',
    ];
  }

}
