<?php

declare(strict_types=1);

namespace Drupal\flowdrop_workflow\Diagnostic;

/**
 * A user's choice of a remedy for a finding (the only thing the client sends).
 *
 * Never carries a mutation payload: the server rebuilds mutations from the
 * (finding, remedy, params) triple at apply time, so a tampered or stale client
 * cannot inject arbitrary edits. `params` is narrowed to what a remedy needs
 * the user to decide — e.g. the chosen node type id for 'replace_node_type'.
 */
final class RemedySelection {

  /**
   * Constructs a RemedySelection.
   *
   * @param string $findingId
   *   The {@see Finding::id()} this selection applies to.
   * @param string $remedyId
   *   The chosen {@see RemedyOption::$id}.
   * @param array<string, mixed> $params
   *   The user's decisions for the remedy (e.g. ['node_type_id' => '…']).
   */
  public function __construct(
    public readonly string $findingId,
    public readonly string $remedyId,
    public readonly array $params = [],
  ) {}

}
