#pragma once

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

private:
    JS_DECLARE_NATIVE_FUNCTION(from_point);
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(x_getter);
    JS_DECLARE_NATIVE_FUNCTION(y_getter);
    JS_DECLARE_NATIVE_FUNCTION(z_getter);
    JS_DECLARE_NATIVE_FUNCTION(w_getter);
    JS_DECLARE_NATIVE_FUNCTION(matrix_transform);
    JS_DECLARE_NATIVE_FUNCTION(to_json);
};

struct DOMPointInit {
    double w { 1 };
    double x { 0 };
    double y { 0 };
    double z { 0 };
};

JS::ThrowCompletionOr<DOMPointInit> convert_to_idl_value_for_dom_point_init(JS::VM&, JS::Value);

} // namespace Web::Bindings
