// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://w3c.github.io/gamepad/extensions.html#gamepadhapticactuatortype-enum
enum GamepadHapticActuatorType {
    "vibration",
    "dual-rumble"
};

enum GamepadHapticEffectType {
    "dual-rumble"
};

enum GamepadHapticsResult {
    "complete",
    "preempted",
    "invalid-parameter",
    "not-supported"
};

// Gamepad vibration is proposed as an extension to the Gamepad API.
// https://docs.google.com/document/d/1jPKzVRNzzU4dUsvLpSXm1VXPQZ8FP-0lKMT-R_p-s6g
// TODO(mattreynolds): Replace this with a link to w3c.github.io/gamepad
[
    OriginTrialEnabled=GamepadExtensions
] interface GamepadHapticActuator {
    readonly attribute GamepadHapticActuatorType type;
    [CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect(
        GamepadHapticEffectType type,
        GamepadEffectParameters params);
    [CallWith=ScriptState] Promise<GamepadHapticsResult> reset();
};
