from __future__ import annotations

from pathlib import Path

from ai_orchestrator.schemas.tool_result import ToolResult
from ai_orchestrator.tools.shell_runner import ShellRunner


class TestRunner:
    def __init__(self, shell_runner: ShellRunner) -> None:
        self.shell_runner = shell_runner

    async def run_tests(
        self,
        *,
        command: str,
        repo_path: Path,
        timeout_seconds: int | None = None,
        use_docker: bool | None = None,
        sandbox_image: str | None = None,
    ) -> ToolResult:
        return await self.shell_runner.run_shell(
            command=command,
            repo_path=repo_path,
            timeout_seconds=timeout_seconds,
            use_docker=use_docker,
            sandbox_image=sandbox_image,
        )
