/** Application info, legal documents and window helpers (main window only). */
import { call } from "../transport";
import type { CoreInfo } from "../types";

export type LegalDocument =
  | "documentation" | "safetyCzech" | "safetyEnglish" | "safetyGerman"
  | "application" | "notice" | "thirdParty" | "thirdPartyBundle" | "tauri" | "electron" | "chromium";

export const app = Object.freeze({
  getInfo: () => call<CoreInfo>("core_get_info", "core:getInfo"),
  openLegalDocument: (document: LegalDocument) => call<{ ok: true }>("core_legal_open", "legal:open", { document }),
  openExternal: (url: string) => call<{ ok: true }>("core_open_external", "core:openExternal", { url })
});
