/**
 * Audio-library storage kinds (Workstream 13). A row in `audio_files` is one of:
 * - `file`  — a binary uploaded via the file subsystem; `url` references it.
 * - `url`   — an external link to an audio resource; `url` holds it.
 * - `recipe`— a client-synthesized sound; `recipe` (JSONB) holds the parameters,
 *             `url` is null. Recipe rows never touch the file subsystem, so they
 *             are exempt from the download ownership check.
 *
 * Exactly one of `url` / `recipe` is populated, matching `kind`.
 */
export const AUDIO_FILE_KINDS = ['file', 'url', 'recipe'] as const;

export type AudioFileKind = (typeof AUDIO_FILE_KINDS)[number];

export function isAudioFileKind(value: unknown): value is AudioFileKind {
  return (
    typeof value === 'string' &&
    (AUDIO_FILE_KINDS as readonly string[]).includes(value)
  );
}

export const AUDIO_FILE_DEFAULT_KIND: AudioFileKind = 'file';
