#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 ShadowRootConstructor {
public:
    static void initialize(JS::Realm&, JS::NativeFunction&);
    static JS::ThrowCompletionOr<GC::Ref<JS::Object>> construct(InterfaceConstructor&, JS::FunctionObject&);

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(mode_getter);
    JS_DECLARE_NATIVE_FUNCTION(delegates_focus_getter);
    JS_DECLARE_NATIVE_FUNCTION(slot_assignment_getter);
    JS_DECLARE_NATIVE_FUNCTION(clonable_getter);
    JS_DECLARE_NATIVE_FUNCTION(serializable_getter);
    JS_DECLARE_NATIVE_FUNCTION(host_getter);
    JS_DECLARE_NATIVE_FUNCTION(onslotchange_getter);
    JS_DECLARE_NATIVE_FUNCTION(onslotchange_setter);
    JS_DECLARE_NATIVE_FUNCTION(inner_html_getter);
    JS_DECLARE_NATIVE_FUNCTION(inner_html_setter);
    JS_DECLARE_NATIVE_FUNCTION(custom_element_registry_getter);
    JS_DECLARE_NATIVE_FUNCTION(active_element_getter);
    JS_DECLARE_NATIVE_FUNCTION(style_sheets_getter);
    JS_DECLARE_NATIVE_FUNCTION(adopted_style_sheets_getter);
    JS_DECLARE_NATIVE_FUNCTION(adopted_style_sheets_setter);
    JS_DECLARE_NATIVE_FUNCTION(fullscreen_element_getter);
    JS_DECLARE_NATIVE_FUNCTION(fullscreen_element_setter);
    JS_DECLARE_NATIVE_FUNCTION(set_html_unsafe);
    JS_DECLARE_NATIVE_FUNCTION(get_html);
    JS_DECLARE_NATIVE_FUNCTION(get_animations);
};

enum class ShadowRootMode : u8 {
    Open,
    Closed,
};

JS::ThrowCompletionOr<ShadowRootMode> convert_to_idl_value_for_shadow_root_mode(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(ShadowRootMode);

enum class SlotAssignmentMode : u8 {
    Manual,
    Named,
};

JS::ThrowCompletionOr<SlotAssignmentMode> convert_to_idl_value_for_slot_assignment_mode(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(SlotAssignmentMode);

} // namespace Web::Bindings
