<?php

declare(strict_types=1);

namespace Plugin\tnt_mcp\src\Mcp\Db;

use RuntimeException;

/**
 * A SQL string the read guard refused to run. Carries a stable machine reason alongside the
 * human message so the MCP tool can surface both — the LLM steers on the reason, the admin
 * reads the message.
 */
final class SqlReadRejected extends RuntimeException
{
    public const PARSE_ERROR      = 'parse_error';
    public const STACKED_QUERY    = 'stacked_query';
    public const NOT_A_SELECT     = 'not_a_select';
    public const SELECT_INTO      = 'select_into';
    public const DENIED_FUNCTION  = 'denied_function';
    public const DENIED_TABLE     = 'denied_table';
    public const DENIED_COLUMN    = 'denied_column';
    public const FOREIGN_DATABASE = 'foreign_database';
    public const LOCKING_READ     = 'locking_read';
    public const EMPTY_QUERY      = 'empty_query';

    public function __construct(public readonly string $reason, string $message)
    {
        parent::__construct($message);
    }
}
