<?php

declare(strict_types=1);

namespace Drupal\flowdrop_session\Constants;

/**
 * Status constants for the FlowDrop Session entity.
 *
 * Session status lifecycle:
 * - IDLE: Initial state, no active execution.
 * - RUNNING: Workflow is currently executing.
 * - AWAITING_INPUT: Waiting for user input (human-in-the-loop).
 * - COMPLETED: Execution finished successfully.
 * - FAILED: Execution failed.
 *
 * @internal
 */
final class SessionStatus {

  public const IDLE = 'idle';

  public const RUNNING = 'running';

  public const AWAITING_INPUT = 'awaiting_input';

  public const COMPLETED = 'completed';

  public const FAILED = 'failed';

  /**
   * 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::IDLE => 'Idle',
      self::RUNNING => 'Running',
      self::AWAITING_INPUT => 'Awaiting Input',
      self::COMPLETED => 'Completed',
      self::FAILED => 'Failed',
    ];
  }

}
