<?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\StartNodeProcessorInterface;

/**
 * Test processor that declares itself a start node without being a trigger.
 *
 * Exists to pin that NodeMetadataResolver suppresses the reserved trigger
 * input port for any StartNodeProcessorInterface, not only triggers — a start
 * node is a workflow entry point that nothing upstream fires.
 */
#[FlowDropNodeProcessor(
  id: "start_probe",
  label: new TranslatableMarkup("Start Probe"),
  description: "Declares itself a start node (test only)",
  version: "1.0.0"
)]
class StartProbe extends AbstractFlowDropNodeProcessor implements StartNodeProcessorInterface {

  /**
   * {@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" => [
        "data" => [
          "type" => "object",
          "description" => "The entry-point payload",
        ],
      ],
    ];
  }

}
