import { createSidecarProxy } from '@@/sidecar/create-proxy';

// /api/headscale/* — auth, then forward to officer-headscale. No routes of its own and no headscale knowledge:
// this file must never grow app logic.
//
// The sidecar exposes only Officer-owned routes under `/_officer/` — Headscale's REST shape differs
// across releases, and version handling belongs in the sidecar. It holds the admin API key; the platform
// does not know Headscale's URL.

const proxy = createSidecarProxy({
  name: 'headscale',
  prefix: '/api/offscale',
});

export const router = proxy.router;

/** Base URL of the sidecar's HTTP server, or null if it hasn't reported in yet. */
export const getHeadscaleServerUrl = proxy.getHttpUrl;
