from __future__ import annotations

from typing import Protocol

from atlas_runner.models import ContainerStatus, RunResult, RunSpec


class RunnerBackend(Protocol):
    """Structural interface for container runtime backends.

    Implementations satisfy this protocol via structural typing — no
    inheritance required.  ``DockerBackend`` is the reference implementation.
    """

    def login(self, registry: str, username: str, password: str) -> None: ...

    def pull(self, image: str) -> None: ...

    def run(self, spec: RunSpec) -> RunResult: ...

    def stop(self, name: str) -> None: ...

    def rm(self, name: str) -> None: ...

    def inspect(self, name: str) -> ContainerStatus: ...

    def ps(self) -> list[ContainerStatus]: ...

    def logs(self, name: str) -> str: ...
