<?php

declare(strict_types=1);

namespace Drupal\flowdrop_interrupt\Attribute;

use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Attribute for FlowDrop interrupt handler plugins.
 *
 * Discovery metadata for handlers of a specific interrupt type. The plugin
 * `id` is also the value persisted in `FlowDropInterrupt::type` — built-in
 * IDs (`confirmation`, `choice`, `text`, `form`, `workflow_execution`)
 * intentionally match the `InterruptType` enum values so existing storage
 * is forward-compatible.
 *
 * Contrib modules add their own types by dropping a plugin class into
 * `Plugin/InterruptHandler/` with this attribute. No core changes
 * required.
 *
 * @see \Drupal\flowdrop_interrupt\Plugin\InterruptHandler\InterruptHandlerInterface
 *
 * @api
 */
#[\Attribute(\Attribute::TARGET_CLASS)]
final class FlowDropInterruptHandler extends Plugin {

  public function __construct(
    public readonly string $id,
    public readonly TranslatableMarkup $label,
    public readonly string $description = '',
    public readonly string $version = '1.0.0',
    public readonly ?string $deriver = NULL,
  ) {}

}
