"""Port for opening, closing, and signalling a worker execution surface."""
from __future__ import annotations

from typing import Protocol

from ..domain.worker_runtime import (
    ProgressEvent,
    RuntimeHandle,
    WorkerSpawnRequest,
)


class WorkerRuntimePort(Protocol):
    surface: str

    def spawn(self, request: WorkerSpawnRequest) -> RuntimeHandle: ...

    def close(self, handle: RuntimeHandle) -> None: ...

    def wait(self, handle: RuntimeHandle) -> int: ...

    def terminate(self, handle: RuntimeHandle) -> None: ...

    def notify(self, event: ProgressEvent) -> None: ...

    def restore_lead(self) -> None: ...
