#pragma once

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

namespace Web::Bindings {

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

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(type_getter);
    JS_DECLARE_NATIVE_FUNCTION(target_getter);
    JS_DECLARE_NATIVE_FUNCTION(src_element_getter);
    JS_DECLARE_NATIVE_FUNCTION(current_target_getter);
    JS_DECLARE_NATIVE_FUNCTION(event_phase_getter);
    JS_DECLARE_NATIVE_FUNCTION(cancel_bubble_getter);
    JS_DECLARE_NATIVE_FUNCTION(cancel_bubble_setter);
    JS_DECLARE_NATIVE_FUNCTION(bubbles_getter);
    JS_DECLARE_NATIVE_FUNCTION(cancelable_getter);
    JS_DECLARE_NATIVE_FUNCTION(return_value_getter);
    JS_DECLARE_NATIVE_FUNCTION(return_value_setter);
    JS_DECLARE_NATIVE_FUNCTION(default_prevented_getter);
    JS_DECLARE_NATIVE_FUNCTION(composed_getter);
    JS_DECLARE_NATIVE_FUNCTION(is_trusted_getter);
    JS_DECLARE_NATIVE_FUNCTION(time_stamp_getter);
    JS_DECLARE_NATIVE_FUNCTION(composed_path);
    JS_DECLARE_NATIVE_FUNCTION(stop_propagation);
    JS_DECLARE_NATIVE_FUNCTION(stop_immediate_propagation);
    JS_DECLARE_NATIVE_FUNCTION(prevent_default);
    JS_DECLARE_NATIVE_FUNCTION(init_event);
};

struct EventInit {
    bool bubbles { false };
    bool cancelable { false };
    bool composed { false };
};

JS::ThrowCompletionOr<EventInit> convert_to_idl_value_for_event_init(JS::VM&, JS::Value);

} // namespace Web::Bindings
