#import <HighResolutionTime/DOMHighResTimeStamp.idl>
#import <Gamepad/GamepadButton.idl>
#import <Gamepad/GamepadHapticActuator.idl>

// https://w3c.github.io/gamepad/#dom-gamepadmappingtype
enum GamepadMappingType {
    "",
    "standard",
    "xr-standard",
};

// https://w3c.github.io/gamepad/#dom-gamepad
[Exposed=Window]
interface Gamepad {
    readonly attribute Utf16DOMString id;
    readonly attribute long index;
    readonly attribute boolean connected;
    readonly attribute DOMHighResTimeStamp timestamp;
    readonly attribute GamepadMappingType mapping;
    readonly attribute FrozenArray<double> axes;
    readonly attribute FrozenArray<GamepadButton> buttons;
    [FIXME] readonly attribute FrozenArray<GamepadTouch> touches;
    [SameObject] readonly attribute GamepadHapticActuator vibrationActuator;
};

// https://w3c.github.io/gamepad/#idl-def-navigator-partial-1
[Exposed=Window]
partial interface Navigator {
    sequence<Gamepad?> getGamepads();
};
