#pragma once

#include <AK/Utf16String.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/InterfaceObject.h>
#include <LibWeb/WebIDL/Types.h>

namespace Web::Bindings {

struct GamepadHapticActuatorConstructor {
public:
    static void initialize(JS::Realm&, JS::NativeFunction&);
    static JS::ThrowCompletionOr<GC::Ref<JS::Object>> construct(InterfaceConstructor&, JS::FunctionObject&);

private:
};

struct GamepadHapticActuatorPrototype {
public:
    static void initialize(JS::Realm&, JS::Object&);
    static void define_unforgeable_attributes(JS::Realm&, JS::Object&);

private:
    JS_DECLARE_NATIVE_FUNCTION(effects_getter);
    JS_DECLARE_NATIVE_FUNCTION(play_effect);
    JS_DECLARE_NATIVE_FUNCTION(reset);
};

enum class GamepadHapticsResult : u8 {
    Complete,
    Preempted,
};

JS::ThrowCompletionOr<GamepadHapticsResult> convert_to_idl_value_for_gamepad_haptics_result(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(GamepadHapticsResult);

enum class GamepadHapticEffectType : u8 {
    DualRumble,
    TriggerRumble,
};

JS::ThrowCompletionOr<GamepadHapticEffectType> convert_to_idl_value_for_gamepad_haptic_effect_type(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(GamepadHapticEffectType);

struct GamepadEffectParameters {
    WebIDL::UnsignedLongLong duration { 0 };
    double left_trigger { 0.0 };
    double right_trigger { 0.0 };
    WebIDL::UnsignedLongLong start_delay { 0 };
    double strong_magnitude { 0.0 };
    double weak_magnitude { 0.0 };
};

JS::ThrowCompletionOr<GamepadEffectParameters> convert_to_idl_value_for_gamepad_effect_parameters(JS::VM&, JS::Value);

} // namespace Web::Bindings
