import type { AutoplayPayload } from './lib/autoplay-ipc';

declare global {
  interface ScreenSource {
    id: string;
    name: string;
    thumbnailDataUrl: string;
    appIconDataUrl: string | null;
  }

  interface Window {
    electronWindow: {
      minimize: () => void;
      maximize: () => void;
      fullscreen: () => void;
      close: () => void;
      openHuddle: (data: { token: string; serverUrl: string }) => void;
      closeHuddle: () => void;
      platform: NodeJS.Platform;
      onMaximizeChange: (
        callback: (isMaximized: boolean) => void,
      ) => () => void;
    };
    electronHuddle: {
      getScreenSources: () => Promise<ScreenSource[]>;
    };
    electronAutoplay: {
      play: (payload: AutoplayPayload) => void;
      dismiss: () => void;
      navigate: (data: { networkId: string; streamId: string }) => void;
      onPlay: (callback: (payload: AutoplayPayload) => void) => () => void;
      onStop: (callback: () => void) => () => void;
      onNavigate: (
        callback: (data: { networkId: string; streamId: string }) => void,
      ) => () => void;
    };
    electronScreen: {
      getScreenSources: () => Promise<ScreenSource[]>;
      startRecordingWindow: () => void;
      stopRecordingWindow: () => void;
      onStopRequested: (callback: () => void) => () => void;
    };
    electronScreenRecord: {
      stop: () => void;
      onInit: (callback: () => void) => () => void;
    };
    electronDeepLink: {
      getPending: () => Promise<string | null>;
      onNavigate: (callback: (path: string) => void) => () => void;
    };
    electronLink: {
      openExternal: (url: string) => Promise<void>;
    };
    electronAttachment: {
      download: (url: string, filename?: string) => void;
    };
    electronApp: {
      setDockBadge: (count: number) => void;
      getVersion: () => Promise<string>;
    };
  }
}

export {};
