<?php

declare(strict_types=1);

namespace Drupal\flowdrop_interrupt\Hook;

use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;

/**
 * Hook implementations for the flowdrop_interrupt module.
 *
 * @internal This class is not part of the public API and may change without notice.
 */
final class InterruptHooks {

  use StringTranslationTrait;

  /**
   * Implements hook_help().
   */
  #[Hook('help')]
  public function help(string $route_name, RouteMatchInterface $route_match): string {
    switch ($route_name) {
      case 'help.page.flowdrop_interrupt':
        $output = '';
        $output .= '<h3>' . $this->t('About') . '</h3>';
        $output .= '<p>' . $this->t('The FlowDrop Interrupt module provides human-in-loop functionality for FlowDrop workflows. It enables workflows to pause execution and request user input (confirmations, choices, text, or forms) before continuing.') . '</p>';
        $output .= '<h3>' . $this->t('Uses') . '</h3>';
        $output .= '<dl>';
        $output .= '<dt>' . $this->t('Confirmation requests') . '</dt>';
        $output .= '<dd>' . $this->t('Use the Confirmation node to pause a workflow and ask the user for a Yes/No decision.') . '</dd>';
        $output .= '<dt>' . $this->t('Choice selection') . '</dt>';
        $output .= '<dd>' . $this->t('Use the Choice Input node to present users with a list of options to select from.') . '</dd>';
        $output .= '<dt>' . $this->t('Text input') . '</dt>';
        $output .= '<dd>' . $this->t('Use the Text Input (Interrupt) node to collect free-form text from users.') . '</dd>';
        $output .= '<dt>' . $this->t('Form input') . '</dt>';
        $output .= '<dd>' . $this->t('Use the Form Input node to collect structured data via JSON Schema-based forms.') . '</dd>';
        $output .= '</dl>';
        return $output;
    }
    return '';
  }

}
