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

private:
};

struct ScreenOrientationPrototype {
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(angle_getter);
    JS_DECLARE_NATIVE_FUNCTION(onchange_getter);
    JS_DECLARE_NATIVE_FUNCTION(onchange_setter);
    JS_DECLARE_NATIVE_FUNCTION(lock);
    JS_DECLARE_NATIVE_FUNCTION(unlock);
};

enum class OrientationType : u8 {
    PortraitPrimary,
    PortraitSecondary,
    LandscapePrimary,
    LandscapeSecondary,
};

JS::ThrowCompletionOr<OrientationType> convert_to_idl_value_for_orientation_type(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(OrientationType);

enum class OrientationLockType : u8 {
    Any,
    Natural,
    Landscape,
    Portrait,
    PortraitPrimary,
    PortraitSecondary,
    LandscapePrimary,
    LandscapeSecondary,
};

JS::ThrowCompletionOr<OrientationLockType> convert_to_idl_value_for_orientation_lock_type(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(OrientationLockType);

} // namespace Web::Bindings
