// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!

// Common helper code.
//
// Ideally this would live in a separate .java file where it can be unittested etc
// in isolation, and perhaps even published as a re-useable package.
//
// However, it's important that the details of how this helper code works (e.g. the
// way that different builtin types are passed across the FFI) exactly match what's
// expected by the Rust code on the other side of the interface. In practice right
// now that means coming from the exact some version of `uniffi` that was used to
// compile the Rust component. The easiest way to ensure this is to bundle the Java
// helpers directly inline like we're doing here.

{% include "RustBufferTemplate.java" %}
{% include "FfiConverterTemplate.java" %}
{% include "Helpers.java" %}
{% include "HandleMap.java" %}

// Contains loading, initialization code,
// and the FFI Function declarations using Java FFM (Foreign Function & Memory API).
{% include "NamespaceLibraryTemplate.java" %}

// Async support
{%- if ci.has_async_fns() %}
{% include "Async.java" %}
{%- endif %}

// Public interface members begin here.
{{ type_helper_code }}

{# Only generate namespace class if there are top-level functions. #}
{%- if !ci.function_definitions().is_empty() %}
package {{ config.package_name() }};

import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

{%- call java::docstring_value(ci.namespace_docstring(), 0) %}
public class {{ self.namespace_class_name() }} {
  {%- for func in ci.function_definitions() %}
  {% call java::func_decl("public static", "", func, 4) %}
  {%- endfor %}
}
{%- endif %}

{% import "macros.java" as java %}
