"""ASV benchmark for TUI fuzzy reference ranking."""

from __future__ import annotations

from typing import ClassVar

from cleveragents.tui.search.fuzzy import rank_candidates


class TuiReferenceFuzzyBench:
    """Bench weighted fuzzy ranking on a medium candidate set."""

    params: ClassVar[list[list[object]]] = [
        [1_000, 10_000],
        ["module_42/file_42", "zzzzzz-no-match-query"],
    ]
    param_names: ClassVar[list[str]] = ["candidate_count", "query"]

    def setup(self, candidate_count: int) -> None:
        self.values = [
            f"src/module_{idx}/file_{idx}.py" for idx in range(candidate_count)
        ]

    def time_rank_candidates(self, candidate_count: int, query: str) -> None:
        del candidate_count
        rank_candidates(query, self.values, limit=20)
