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

private:
};

struct CryptoKeyPrototype {
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(extractable_getter);
    JS_DECLARE_NATIVE_FUNCTION(algorithm_getter);
    JS_DECLARE_NATIVE_FUNCTION(usages_getter);
};

enum class KeyType : u8 {
    Public,
    Private,
    Secret,
};

JS::ThrowCompletionOr<KeyType> convert_to_idl_value_for_key_type(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(KeyType);

enum class KeyUsage : u8 {
    Encrypt,
    Decrypt,
    Sign,
    Verify,
    Derivekey,
    Derivebits,
    Wrapkey,
    Unwrapkey,
    Encapsulatekey,
    Encapsulatebits,
    Decapsulatekey,
    Decapsulatebits,
};

JS::ThrowCompletionOr<KeyUsage> convert_to_idl_value_for_key_usage(JS::VM&, JS::Value);

Utf16String idl_enum_to_string(KeyUsage);

} // namespace Web::Bindings
