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

// /api/music/* — auth, then forward to officer-music. No routes of its own and no music knowledge:
// this file must never grow app logic.
//
// The sidecar owns the entire /api/music/* contract: streaming, indexing, AND per-user state (favorites,
// now-playing, playlists) backed by Postgres. The full HTTP contract is documented at the top of the
// sidecar's fetch handler — src/servers/sidecar/music/index.ts.

const proxy = createSidecarProxy({
  name: 'music',
  prefix: '/api/music',
  timeoutSeconds: 1800,
});

export const musicRouter = proxy.router;

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

/** The same server as a `ws://` base — the cliamp relay pipes the player socket to it. */
export const getMusicServerWsUrl = proxy.getWsUrl;
