#pragma once

#include <AK/Optional.h>
#include <AK/Vector.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/CookieStore.h>
#include <LibWeb/Bindings/Event.h>
#include <LibWeb/Bindings/InterfaceObject.h>

namespace Web::Bindings {

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

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(changed_getter);
    JS_DECLARE_NATIVE_FUNCTION(deleted_getter);
};

struct CookieChangeEventInit : public EventInit {
    Optional<Vector<CookieListItem>> changed {};
    Optional<Vector<CookieListItem>> deleted {};
};

JS::ThrowCompletionOr<CookieChangeEventInit> convert_to_idl_value_for_cookie_change_event_init(JS::VM&, JS::Value);

} // namespace Web::Bindings
