import { invoke } from "@tauri-apps/api/core";
import { CleanConfig } from "./types";

export type InitialStatePayload = {
  config: CleanConfig;
  hotkey_conflict: boolean;
  hwid: string;
  is_licensed: boolean;
};

export const api = {
  getInitialState: () => invoke<InitialStatePayload>("get_initial_state"),
  updateConfig: (config: CleanConfig) =>
    invoke<void>("update_config", { config }),
  getHotkeyStatus: () => invoke<[string, boolean]>("get_hotkey_status"),
  activateLicense: (licenseKey: string) =>
    invoke<void>("activate_license_command", { licenseKey }),
  verifyOfflineToken: (token: string) =>
    invoke<void>("verify_and_save_offline_token", { token }),
  showSettingsWindow: () => invoke<void>("show_settings_window"),
};
