<?php

declare(strict_types=1);

namespace Drupal\flowdrop_node_type_test\Plugin\FlowDropNodeProcessor;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\flowdrop\Attribute\FlowDropNodeProcessor;
use Drupal\flowdrop\DTO\ParameterBagInterface;
use Drupal\flowdrop\DTO\ValidationResult;
use Drupal\flowdrop\Plugin\FlowDropNodeProcessor\AbstractFlowDropNodeProcessor;
use Drupal\flowdrop\Plugin\FlowDropNodeProcessor\TerminalNodeProcessorInterface;

/**
 * Test processor that declares itself a terminal node.
 *
 * Exists to pin that NodeMetadataResolver suppresses the reserved trigger
 * output port for any TerminalNodeProcessorInterface, not only the shipped
 * Stop node — a terminal node ends the run when reached, so an outgoing
 * trigger port is meaningless there.
 */
#[FlowDropNodeProcessor(
  id: "terminal_probe",
  label: new TranslatableMarkup("Terminal Probe"),
  description: "Declares itself a terminal node (test only)",
  version: "1.0.0"
)]
class TerminalProbe extends AbstractFlowDropNodeProcessor implements TerminalNodeProcessorInterface {

  /**
   * {@inheritdoc}
   */
  public function validateParams(array $params): ValidationResult {
    return ValidationResult::success();
  }

  /**
   * {@inheritdoc}
   */
  public function process(ParameterBagInterface $params): array {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getParameterSchema(): array {
    return [
      "type" => "object",
      "properties" => [],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getOutputSchema(): array {
    return [
      "type" => "object",
      "properties" => [],
    ];
  }

}
