import { LiveList, LiveObject } from "@liveblocks/client";

export { useOthers } from "@liveblocks/react/suspense";

type Clip = {
  id: string;
  image_url: string;
  audio_url: string;
  title: string;
  metadata: any;

  submitterId: number;
  submitterUsername?: string;
  url: string;
};

type ClipPlaying = {
  state: {
    clip: Clip;
    playTimestamp: number;
    seekTime: number;
    isPlaying: boolean;
  } | null;
};

declare global {
  interface Liveblocks {
    // Each user's Presence, for useMyPresence, useOthers, etc.
    Presence: {
      username: string;
    };

    // The Storage tree for the room, for useMutation, useStorage, etc.
    Storage: {
      clips: LiveList<LiveObject<Clip>>;
      currentPlay: LiveObject<ClipPlaying>;
    };

    UserMeta: {
      id: string;
      // Custom user info set when authenticating with a secret key
      info: {};
    };

    // Custom events, for useBroadcastEvent, useEventListener
    RoomEvent: {
      type: string;
      emoji: string;
      username: string;
      comment: string;
    };

    // Custom metadata set on threads, for useThreads, useCreateThread, etc.
    ThreadMetadata: {};

    // Custom room info set with resolveRoomsInfo, for useRoomInfo
    RoomInfo: {};

    // Custom activities data for custom notification kinds
    ActivitiesData: {};
  }
}

// Necessary if you have no imports/exports
export {};
