"use client";

import { WaveformPlayer } from "./waveform-player";

/**
 * Episode audio player — a thin wrapper around the custom WaveformPlayer so the
 * authed asset route and (optional) ZIP export are wired up for the editor.
 */
export function AudioPlayer({
  storageKey,
  durationSec,
  episodeId,
}: {
  storageKey: string;
  durationSec?: number | null;
  episodeId?: string;
}) {
  const src = `/api/assets/${storageKey}`;
  return (
    <WaveformPlayer
      src={src}
      downloadUrl={`${src}?download=1`}
      durationSec={durationSec}
      exportUrl={episodeId ? `/api/episodes/${episodeId}/export` : undefined}
    />
  );
}
