"""Runtime directory for JSON maps and remote_ssh.env (the hub_manager.py install location)."""

import os
from typing import Optional

_BASE: Optional[str] = None


def configure(app_dir: str) -> None:
    """Call once from hub_manager.py with dirname(abspath(__file__))."""
    global _BASE
    _BASE = os.path.abspath(app_dir)


def base_dir() -> str:
    if _BASE is None:
        raise RuntimeError("hubmgr.paths.configure() was not called (run via hub_manager.py)")
    return _BASE


def panel_map_path() -> str:
    return os.path.join(base_dir(), "panel_map.json")


def fiber_map_path() -> str:
    return os.path.join(base_dir(), "fiber_map.json")
