// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate.
// Trust me, you don't want to mess with it!

import {
  ArrayBufferDataStream,
  FfiConverter,
  FfiConverterArrayBuffer,
  FfiConverterInt8,
  FfiConverterUInt8,
  FfiConverterInt16,
  FfiConverterUInt16,
  FfiConverterInt32,
  FfiConverterUInt32,
  FfiConverterInt64,
  FfiConverterUInt64,
  FfiConverterFloat32,
  FfiConverterFloat64,
  FfiConverterBoolean,
  FfiConverterBytes,
  FfiConverterString,
  UniFFICallbackHandler,
  UniFFICallbackMethodHandler,
  UniFFIError,
  UniFFIInternalError,
  UniFFITypeError,
  constructUniffiObject,
  handleRustResult,
  uniffiObjectPtr,
} from "moz-src:///toolkit/components/uniffi-js/js/UniFFI.sys.mjs";

// Objects intended to be used in the unit tests
export var UnitTestObjs = {
    uniffiObjectPtr,
};
/**
 * roundtripExtCustomType
 * @param {Handle} custom
 * @returns {Handle}
 */
export function roundtripExtCustomType(
    custom) {
   
if (custom instanceof UniffiSkipJsTypeCheck) {
    custom = custom.value;
} else {
    FfiConverterTypeHandle.checkType(custom);
}
const result = UniFFIScaffolding.callSync(
    347, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_custom_type
    FfiConverterTypeHandle.lower(custom),
)
return handleRustResult(
    result,
    FfiConverterTypeHandle.lift.bind(FfiConverterTypeHandle),
    null,
)
}

/**
 * roundtripExtEnum
 * @param {EnumWithData[keyof EnumWithData]} en
 * @returns {EnumWithData[keyof EnumWithData]}
 */
export function roundtripExtEnum(
    en) {
   
if (en instanceof UniffiSkipJsTypeCheck) {
    en = en.value;
} else {
    FfiConverterTypeEnumWithData.checkType(en);
}
const result = UniFFIScaffolding.callSync(
    348, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_enum
    FfiConverterTypeEnumWithData.lower(en),
)
return handleRustResult(
    result,
    FfiConverterTypeEnumWithData.lift.bind(FfiConverterTypeEnumWithData),
    null,
)
}

/**
 * roundtripExtInterface
 * @param {TestInterface} int
 * @returns {TestInterface}
 */
export function roundtripExtInterface(
    int) {
   
if (int instanceof UniffiSkipJsTypeCheck) {
    int = int.value;
} else {
    FfiConverterTypeTestInterface.checkType(int);
}
const result = UniFFIScaffolding.callSync(
    349, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_interface
    FfiConverterTypeTestInterface.lower(int),
)
return handleRustResult(
    result,
    FfiConverterTypeTestInterface.lift.bind(FfiConverterTypeTestInterface),
    null,
)
}

/**
 * roundtripExtRecord
 * @param {SimpleRec} rec
 * @returns {SimpleRec}
 */
export function roundtripExtRecord(
    rec) {
   
if (rec instanceof UniffiSkipJsTypeCheck) {
    rec = rec.value;
} else {
    FfiConverterTypeSimpleRec.checkType(rec);
}
const result = UniFFIScaffolding.callSync(
    350, // uniffi_uniffi_bindings_tests_external_types_fn_func_roundtrip_ext_record
    FfiConverterTypeSimpleRec.lower(rec),
)
return handleRustResult(
    result,
    FfiConverterTypeSimpleRec.lift.bind(FfiConverterTypeSimpleRec),
    null,
)
}


import {
  FfiConverterTypeHandle,
} from "./RustUniffiBindingsTests.sys.mjs";

// Export the FFIConverter object to make external types work.
export { FfiConverterTypeHandle };


import {
  FfiConverterTypeEnumWithData,
} from "./RustUniffiBindingsTests.sys.mjs";

// Export the FFIConverter object to make external types work.
export { FfiConverterTypeEnumWithData };
import {
  FfiConverterTypeTestInterface,
} from "./RustUniffiBindingsTests.sys.mjs";

// Export the FFIConverter object to make external types work.
export { FfiConverterTypeTestInterface };
import {
  FfiConverterTypeSimpleRec,
} from "./RustUniffiBindingsTests.sys.mjs";

// Export the FFIConverter object to make external types work.
export { FfiConverterTypeSimpleRec };


// Wrapper to skip type checking for function arguments
//
// This is only defined and used on test fixtures.  The goal is to skip the JS type checking so that
// we can test the lower-level C++ type checking.
export class UniffiSkipJsTypeCheck {
    constructor(value) {
        this.value = value;
    }
}
