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

// /api/jellyfin/* — auth, then forward to officer-jellyfin. No routes of its own and no Jellyfin knowledge:
// this file must never grow app logic.
//
// The sidecar owns the Jellyfin contract and holds its credentials.
//
// `timeoutSeconds` is generous because this proxy carries VIDEO. A direct-play stream holds one connection
// open for the length of the film, and the first request against a fresh transcode waits on ffmpeg starting
// up. The default 60s idle drop would cut both.

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

export const jellyfinRouter = proxy.router;

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