<?php

declare(strict_types=1);

namespace Drupal\flowdrop_runtime\Service\Orchestrator;

use Drupal\flowdrop\DTO\Output;
use Drupal\flowdrop_workflow\DTO\WorkflowDTO;

/**
 * Interface for iterator node executors.
 *
 * Implementations handle the execution of iterator nodes, which process
 * collections by iterating over items and executing sub-workflows.
 *
 * @internal This interface is not part of the public API and may change without notice.
 */
interface IteratorExecutorInterface {

  /**
   * Executes an iterator node.
   *
   * @param string $executionId
   *   The execution ID.
   * @param string $nodeId
   *   The iterator node ID.
   * @param array<string, mixed> $inputData
   *   The input data for the iterator.
   * @param array<string, mixed> $config
   *   The iterator configuration.
   * @param \Drupal\flowdrop_workflow\DTO\WorkflowDTO $workflow
   *   The workflow DTO.
   * @param string $pipelineId
   *   The parent pipeline ID.
   *
   * @return \Drupal\flowdrop\DTO\Output
   *   The iterator execution output.
   */
  public function execute(
    string $executionId,
    string $nodeId,
    array $inputData,
    array $config,
    WorkflowDTO $workflow,
    string $pipelineId,
  ): Output;

}
