# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 Substratum Labs

from __future__ import annotations

from collections.abc import AsyncIterator
from typing import Protocol

from roche_sandbox.types import ExecEvent, ExecOutput, SandboxConfig, SandboxInfo


class Transport(Protocol):
    async def create(self, config: SandboxConfig, provider: str) -> str: ...
    async def exec(self, sandbox_id: str, command: list[str], provider: str, timeout_secs: int | None = None, trace_level: str | None = None, idempotency_key: str | None = None) -> ExecOutput: ...
    def exec_stream(self, sandbox_id: str, command: list[str], provider: str, timeout_secs: int | None = None, trace_level: str | None = None) -> AsyncIterator[ExecEvent]: ...
    async def destroy(self, sandbox_ids: list[str], provider: str, all: bool = False) -> list[str]: ...
    async def list(self, provider: str) -> list[SandboxInfo]: ...
    async def pause(self, sandbox_id: str, provider: str) -> None: ...
    async def unpause(self, sandbox_id: str, provider: str) -> None: ...
    async def gc(self, provider: str, dry_run: bool = False, all: bool = False) -> list[str]: ...
    async def copy_to(self, sandbox_id: str, host_path: str, sandbox_path: str, provider: str) -> None: ...
    async def copy_from(self, sandbox_id: str, sandbox_path: str, host_path: str, provider: str) -> None: ...
