//////////////////////////////////////////////////////////////////////////////////////////
//   _  _ ____ _  _ ___  ____                                                           //
//   |_/  |__| |\ | |  \ |  |    This file belongs to Kando, the cross-platform         //
//   | \_ |  | | \| |__/ |__|    pie menu. Read more on github.com/kando-menu/kando     //
//                                                                                      //
//////////////////////////////////////////////////////////////////////////////////////////

// SPDX-FileCopyrightText: Simon Schneegans <code@simonschneegans.de>
// SPDX-License-Identifier: MIT

export type Native = {
  /**
   * This simulates a mouse movement.
   *
   * @param dx The horizontal movement in pixels.
   * @param dy The vertical movement in pixels.
   */
  movePointer(dx: number, dy: number): void;

  /**
   * This simulates a key press or release.
   *
   * @param keycode The X11 scan code to simulate.
   * @param down If true, a key press is simulated. Otherwise, a key release is simulated.
   */
  simulateKey(keycode: number, down: boolean): void;

  /**
   * This retrieves the app and class of the currently focused window.
   *
   * @returns The app and class of the currently focused window.
   */
  getActiveWindow(): { app: string; name: string };

  /**
   * This retrieves all currently open windows.
   *
   * @returns An array containing app and window names.
   */
  getOpenWindows(): { app: string; window: string }[];

  /**
   * This focuses a currently open window.
   *
   * @param windowName The window title to focus.
   * @param appName The app name or bundle identifier owning the window.
   */
  focusWindow(windowName: string, appName: string): void;

  /**
   * This lists all installed applications.
   *
   * @returns An array of objects containing the application's ID, name, and
   *   base64-encoded icon.
   */
  listInstalledApplications(): {
    name: string;
    id: string;
    base64Icon: string;
  }[];
};

const native: Native = require('./../../../../../build/Release/NativeMacOS.node');

export { native };
