<?php

declare(strict_types=1);

namespace Plugin\tnt_mcp\src\Mcp\Db;

/**
 * The outcome of {@see SqlReadGuard::check()}: the SQL that may actually be executed, rebuilt
 * from the parsed AST, plus everything the tool response has to be honest about.
 *
 * `$sql` is NEVER the caller's string — it is `SelectStatement::build()` output, so anything the
 * parser did not understand is not in it. That rewrite is visible to the caller by design.
 */
final class GuardedQuery
{
    /**
     * @param string       $sql        rebuilt, execution-ready SELECT
     * @param string       $original   exactly what the caller sent
     * @param list<string> $tables     lower-cased table names the SELECT reads
     * @param int          $rowLimit   the LIMIT that is in $sql
     * @param list<string> $notes      caller-facing remarks (limit injected, query rewritten, …)
     */
    public function __construct(
        public readonly string $sql,
        public readonly string $original,
        public readonly array $tables,
        public readonly int $rowLimit,
        public readonly array $notes,
    ) {
    }
}
