#pragma once

#include <AK/String.h>
#include <LibGC/Ptr.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/Event.h>
#include <LibWeb/Bindings/InterfaceObject.h>
#include <LibWeb/Forward.h>

namespace Web::Bindings {

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

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(old_state_getter);
    JS_DECLARE_NATIVE_FUNCTION(new_state_getter);
    JS_DECLARE_NATIVE_FUNCTION(source_getter);
};

struct ToggleEventInit : public EventInit {
    String new_state { String {} };
    String old_state { String {} };
    GC::Ptr<DOM::Element> source { nullptr };
};

JS::ThrowCompletionOr<ToggleEventInit> convert_to_idl_value_for_toggle_event_init(JS::VM&, JS::Value);

} // namespace Web::Bindings
