# kernbench/engine/dummy.py
from __future__ import annotations

from dataclasses import dataclass
from typing import Any

from kernbench.common.types import Completion, RequestHandle, SimEngine, Trace


@dataclass
class DummyEngine(SimEngine):
    topology: object
    device_raw: str
    _n: int = 0
    _store: dict[str, tuple[Completion, Trace | None]] = None  # type: ignore

    def __post_init__(self) -> None:
        self._store = {}

    def submit(self, request: Any) -> RequestHandle:
        self._n += 1
        h = RequestHandle(f"h{self._n}")
        # 여기서 request 처리/시뮬레이션/스케줄링 등을 수행
        self._store[str(h)] = (Completion(ok=True), {"request": request, "device": self.device_raw})
        return h

    def get_completion(self, handle: RequestHandle) -> tuple[Completion, Trace | None]:
        return self._store[str(handle)]

    def wait(self, handle: RequestHandle) -> None:
        pass
