<?php

declare(strict_types=1);

namespace Drupal\flowdrop_workflow\Diagnostic;

use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * An offered fix for a {@see Finding} — a descriptor, never executable code.
 *
 * The owning diagnostic turns a chosen (finding, remedyId, params) into
 * mutation primitives ({@see Mutation\WorkflowMutationInterface}) at apply
 * time. A remedy carries only what the UI needs to render the choice and what
 * the diagnostic needs to rebuild the mutation server-side.
 */
final class RemedyOption {

  /**
   * Constructs a RemedyOption.
   *
   * @param string $id
   *   The remedy id, unique within its finding (e.g. 'remove_edge',
   *   'reset_config', 'replace_node_type'). The client echoes this back as the
   *   chosen remedy; the diagnostic switches on it in buildMutations().
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup $label
   *   The short action label shown on the radio option.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup $description
   *   A one-line explanation of what the remedy does.
   * @param bool $destructive
   *   TRUE when the remedy removes a node or edge (drives UI emphasis).
   * @param array<string, mixed> $params
   *   Optional render/apply parameters — e.g. 'choices' (a map of id => label)
   *   for a remedy that needs the user to pick a value, like replacing a node
   *   type. Echoed back (possibly narrowed to the user's pick) at apply time.
   */
  public function __construct(
    public readonly string $id,
    public readonly TranslatableMarkup $label,
    public readonly TranslatableMarkup $description,
    public readonly bool $destructive = FALSE,
    public readonly array $params = [],
  ) {}

}
