"""FastVM provider configuration.

All values are read from environment variables so the provider stays
`boto3`-style drop-in — no code changes needed to retarget between dev
(`api.fastvm.dev`) and prod (`api.fastvm.org`).

Required:
  FASTVM_API_KEY        — `hlm_…` bearer token for the FastVM API.

Optional:
  FASTVM_BASE_URL                  — default `https://api.fastvm.org`.
  FASTVM_OSWORLD_SNAPSHOT_ID       — snapshot to restore from on each launch.
                                     Required for the OSWorld workload (the
                                     snapshot must contain `osworld_server`
                                     listening on :5000). If unset, the VM
                                     boots from the default FastVM image and
                                     the in-VM server wait will time out.
  FASTVM_MACHINE_TYPE              — default `c4m8`. Ignored when launching
                                     from a snapshot (inherits source shape).
  FASTVM_DISK_GIB                  — optional disk override; the OSWorld
                                     image is ~25 GiB so 32 is a safe default.
  FASTVM_READY_TIMEOUT_SEC         — wait budget for the in-VM :5000 check
                                     after the VM reaches `running`.
                                     Default 300.
  FASTVM_LAUNCH_TIMEOUT_SEC        — wait budget for VM status=running.
                                     Default 300.
  FASTVM_SKIP_READY_CHECK          — "1" to skip the :5000 health probe.
                                     Useful when smoke-testing the control
                                     plane integration before the OSWorld
                                     image is baked.
"""
from __future__ import annotations

import os

DEFAULT_MACHINE_TYPE = os.environ.get("FASTVM_MACHINE_TYPE", "c4m8")
OSWORLD_SNAPSHOT_ID = os.environ.get("FASTVM_OSWORLD_SNAPSHOT_ID") or None
DISK_GIB = int(os.environ.get("FASTVM_DISK_GIB", "0")) or None  # 0/unset → omit
LAUNCH_TIMEOUT_SEC = float(os.environ.get("FASTVM_LAUNCH_TIMEOUT_SEC", "300"))
READY_TIMEOUT_SEC = float(os.environ.get("FASTVM_READY_TIMEOUT_SEC", "300"))
SKIP_READY_CHECK = os.environ.get("FASTVM_SKIP_READY_CHECK") == "1"

# OSWorld in-VM service ports. Kept constant across providers so the
# DesktopEnv controllers don't care which backend we're on.
SERVER_PORT = 5000
CHROMIUM_PORT = 9222
VNC_PORT = 8006
VLC_PORT = 8080
NOVNC_PORT = 5910
