import type Accessor from "../../../core/Accessor.js";
import type Collection from "../../../core/Collection.js";
import type GamepadInputDevice from "./GamepadInputDevice.js";

export interface GamepadSettingsProperties extends Partial<Pick<GamepadSettings, "enabledFocusMode">> {}

/**
 * Gamepad input specific configuration settings.
 *
 * @since 4.9
 */
export default abstract class GamepadSettings extends Accessor {
  /**
   * A readonly collection of all gamepads detected.
   * This collection can be monitored for connecting and disconnecting gamepads.
   * This property may only be populated after interaction with a connected gamepad device. See example below.
   *
   * @example
   * const { devices } = view.input.gamepad;
   * devices.on("change", () => {
   *   console.log(`Available devices...`);
   *   for (const gamepad of devices) {
   *     const { id, index } = gamepad.native;
   *     console.log(`
   *       Device name:  ${id}
   *       Device index: ${index}
   *     `);
   *   }
   * });
   */
  get devices(): Collection<GamepadInputDevice>;
  /**
   * Determines what focus is required for gamepad events to be dispatched.
   *
   * Possible Value | Description
   * ---------------|------------
   * document | Gamepad events are emitted when any part of the current webpage has focus. This allows for gamepad events being emitted even while a UI element is focused.
   * view | Gamepad events are emitted when the view's container element has browser focus. This is useful when multiple views might be present on a single webpage.
   * none | Gamepad events are emitted independently of focus.
   *
   * @default "document"
   */
  accessor enabledFocusMode: "document" | "view" | "none";
}