#pragma once

#include <AK/Optional.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>
#include <LibWeb/Bindings/PredefinedColorSpace.h>

namespace Web::Bindings {

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

private:
    static JS::ThrowCompletionOr<GC::Ref<JS::Object>> construct0(InterfaceConstructor&, JS::FunctionObject&);
    static JS::ThrowCompletionOr<GC::Ref<JS::Object>> construct1(InterfaceConstructor&, JS::FunctionObject&);
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(width_getter);
    JS_DECLARE_NATIVE_FUNCTION(height_getter);
    JS_DECLARE_NATIVE_FUNCTION(data_getter);
    JS_DECLARE_NATIVE_FUNCTION(color_space_getter);
};

struct ImageDataSettings {
    Optional<PredefinedColorSpace> color_space {};
};

JS::ThrowCompletionOr<ImageDataSettings> convert_to_idl_value_for_image_data_settings(JS::VM&, JS::Value);

} // namespace Web::Bindings
