<?php

declare(strict_types=1);

namespace Drupal\Tests\flowdrop_workflow_executor\Unit;

use Drupal\Tests\UnitTestCase;
use Drupal\flowdrop_workflow_executor\Service\WorkflowExecutionServiceInterface;
use Drupal\Tests\flowdrop\Unit\Traits\InterfaceContractTestTrait;

/**
 * Tests workflow executor interface contracts are stable.
 *
 * @group flowdrop_workflow_executor
 */
class InterfaceContractTest extends UnitTestCase {

  use InterfaceContractTestTrait;

  /**
   * Tests WorkflowExecutionServiceInterface method signatures.
   *
   * @covers \Drupal\flowdrop_workflow_executor\Service\WorkflowExecutionServiceInterface
   */
  public function testWorkflowExecutionServiceInterface(): void {
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'execute',
      ['workflow', 'inputData', 'mode', 'timeout', 'pollIntervalMs', 'parentContext']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'getResults',
      ['sessionId', 'waitForCompletion', 'timeout', 'pollIntervalMs']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'isComplete',
      ['sessionId']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'getStatus',
      ['sessionId']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'cancelExecution',
      ['sessionId', 'reason', 'initiatorUid']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'cancelPipeline',
      ['pipelineId', 'reason', 'initiatorUid']
    );
    $this->assertInterfaceHasMethod(
      WorkflowExecutionServiceInterface::class,
      'getPipelineOutputs',
      ['pipelineId']
    );
    $this->assertInterfaceMethodCount(WorkflowExecutionServiceInterface::class, 7);
  }

}
