// [P5-15 v2] Soundboard packs — a near-parallel of the MSC2545 custom-emoji
// image packs (see ../custom-emoji/types.ts), for shareable in-call audio clips.

/** io.lotus.soundboard_rooms content (global refs) — mirrors EmoteRoomsContent. */
export type SoundboardPackStateKeyToObject = Record<string, object>;
export type SoundboardRoomIdToStateKey = Record<string, SoundboardPackStateKeyToObject>;
export type SoundboardRoomsContent = {
  rooms?: SoundboardRoomIdToStateKey;
};

/** Per-clip media info (audio, so no width/height — unlike IImageInfo). */
export type SoundboardClipInfo = {
  mimetype?: string;
  size?: number;
  /** Clip duration in milliseconds, if known. */
  duration?: number;
};

/** A single soundboard clip (parallels PackImage). Keyed by shortcode in the pack. */
export type SoundboardClip = {
  url: string; // mxc://
  body?: string; // display name
  emoji?: string; // emoji tag (like a Discord soundboard emoji)
  volume?: number; // 0–100, per-clip gain
  info?: SoundboardClipInfo;
};

export type SoundboardClips = Record<string, SoundboardClip>;

export type SoundboardMeta = {
  display_name?: string;
  avatar_url?: string;
  attribution?: string;
};

/** io.lotus.soundboard (user account data) + io.lotus.soundboard (room state). */
export type SoundboardContent = {
  pack?: SoundboardMeta;
  clips?: SoundboardClips;
};

/** Legacy v1 personal soundboard shape (flat list), migrated to a pack on read. */
export type LegacySoundboardClip = {
  id: string;
  name: string;
  url: string;
  mimetype?: string;
  size?: number;
};
export type LegacySoundboardContent = {
  clips?: LegacySoundboardClip[];
};
