/**
 * 桌面端（Electron）preload 注入的全局 API 类型声明
 * 形状与 apps/desktop/src/preload/index.ts 暴露的 desktopAPI 保持同步；
 * 浏览器环境该对象不存在（可选属性），业务代码统一走 #/util/desktop 封装访问。
 */
interface Window {
  desktopAPI?: {
    /** 桌面端标记，恒为 true */
    isElectron: true;
    /** 当前平台：win32 / darwin / linux */
    platform: string;
    getVersion: () => Promise<string>;
    notify: (options: { body: string; route?: string; title: string }) => Promise<boolean>;
    setBadge: (count: number) => Promise<void>;
    flashFrame: () => Promise<void>;
    getAutoLaunch: () => Promise<boolean>;
    setAutoLaunch: (enable: boolean) => Promise<boolean>;
    getPrinters: () => Promise<
      Array<{ displayName: string; isDefault: boolean; name: string }>
    >;
    printHTML: (options: {
      deviceName?: string;
      html: string;
      silent?: boolean;
    }) => Promise<{ message?: string; ok: boolean }>;
    getSettings: () => Promise<{ printerName: string; silentPrint: boolean }>;
    setSettings: (
      patch: Partial<{ printerName: string; silentPrint: boolean }>,
    ) => Promise<{ printerName: string; silentPrint: boolean }>;
    checkUpdate: () => Promise<void>;
    focusWindow: () => Promise<void>;
    onNavigate: (callback: (route: string) => void) => void;
    onUpdateEvent: (
      callback: (payload: { data?: unknown; type: string }) => void,
    ) => void;
  };
}
