#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>

namespace Web::Bindings {

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

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(length_getter);
    JS_DECLARE_NATIVE_FUNCTION(scroll_restoration_getter);
    JS_DECLARE_NATIVE_FUNCTION(scroll_restoration_setter);
    JS_DECLARE_NATIVE_FUNCTION(state_getter);
    JS_DECLARE_NATIVE_FUNCTION(go);
    JS_DECLARE_NATIVE_FUNCTION(back);
    JS_DECLARE_NATIVE_FUNCTION(forward);
    JS_DECLARE_NATIVE_FUNCTION(push_state);
    JS_DECLARE_NATIVE_FUNCTION(replace_state);
};

enum class ScrollRestoration : u8 {
    Auto,
    Manual,
};

JS::ThrowCompletionOr<ScrollRestoration> convert_to_idl_value_for_scroll_restoration(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(ScrollRestoration);

} // namespace Web::Bindings
