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

private:
};

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

private:
    JS_DECLARE_NATIVE_FUNCTION(encoding_getter);
    JS_DECLARE_NATIVE_FUNCTION(fatal_getter);
    JS_DECLARE_NATIVE_FUNCTION(ignore_bom_getter);
    JS_DECLARE_NATIVE_FUNCTION(decode);
};

struct TextDecoderOptions {
    bool fatal { false };
    bool ignore_bom { false };
};

JS::ThrowCompletionOr<TextDecoderOptions> convert_to_idl_value_for_text_decoder_options(JS::VM&, JS::Value);

struct TextDecodeOptions {
    bool stream { false };
};

JS::ThrowCompletionOr<TextDecodeOptions> convert_to_idl_value_for_text_decode_options(JS::VM&, JS::Value);

} // namespace Web::Bindings
