import type Accessor from "../../../core/Accessor.js";
import type GamepadInputDevice from "../../input/gamepad/GamepadInputDevice.js";
import type { GamepadInputDeviceProperties } from "../../input/gamepad/GamepadInputDevice.js";

export interface GamepadSettingsProperties extends Partial<Pick<GamepadSettings, "enabled" | "mode" | "tiltDirection">> {
  /**
   * Use this property to explicitly select the gamepad device for map and scene navigation.
   * If unspecified then all connected gamepads will be able to navigate.
   *
   * @since 4.9
   * @see [View.input.gamepad.devices](https://developers.arcgis.com/javascript/latest/references/core/views/input/gamepad/GamepadSettings/#devices) for a collection of detected gamepads.
   */
  device?: GamepadInputDeviceProperties | null;
}

/**
 * Gamepad navigation specific configuration settings.
 *
 * @since 4.9
 */
export default class GamepadSettings extends Accessor {
  constructor(properties?: GamepadSettingsProperties);
  /**
   * Use this property to explicitly select the gamepad device for map and scene navigation.
   * If unspecified then all connected gamepads will be able to navigate.
   *
   * @since 4.9
   * @see [View.input.gamepad.devices](https://developers.arcgis.com/javascript/latest/references/core/views/input/gamepad/GamepadSettings/#devices) for a collection of detected gamepads.
   */
  get device(): GamepadInputDevice | null | undefined;
  set device(value: GamepadInputDeviceProperties | null | undefined);
  /**
   * Whether gamepad navigation is enabled on the View.
   * If this is enabled, but no `device` is specified, the first supported one
   * will be selected automatically.
   *
   * @default true
   * @since 4.9
   */
  accessor enabled: boolean;
  /**
   * This setting controls the behavior of forward and back movement of the left stick. If set to `pan`, movement will be at a constant
   * altitude (panning the view forward and backward) whereas `zoom` will move the view in the viewing direction. Pan is best suited for exploring
   * a scene as if on foot or in a car. Zoom mode provides great control to navigate the scene similar to a flight simulator.
   *
   * The following are the possible values for each view:
   * **MapView:** `"pan"`
   * **SceneView:** `"pan" | "zoom"`
   *
   * @default "pan"
   * @since 4.9
   * @example
   * // Setting the navigation mode to "zoom"
   * sceneView.navigation.gamepad.mode = "zoom";
   */
  accessor mode: "pan" | "zoom";
  /**
   * Determines whether pressing the tilt axis forwards make the view tilt down (towards the nadir), or up (towards the zenith).
   * The default behavior is to tilt the view down when pressing the stick that controls tilt forwards.
   *
   * @default "forward-down"
   * @since 4.9
   */
  accessor tiltDirection: "forward-down" | "forward-up";
}