///
/// JGetItemParams.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "GetItemParams.hpp"

#include <string>

namespace margelo::nitro::keychainmodule {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ struct "GetItemParams" and the Kotlin data class "GetItemParams".
   */
  struct JGetItemParams final: public jni::JavaClass<JGetItemParams> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/keychainmodule/GetItemParams;";

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct GetItemParams by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    GetItemParams toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldKey = clazz->getField<jni::JString>("key");
      jni::local_ref<jni::JString> key = this->getFieldValue(fieldKey);
      return GetItemParams(
        key->toStdString()
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JGetItemParams::javaobject> fromCpp(const GetItemParams& value) {
      using JSignature = JGetItemParams(jni::alias_ref<jni::JString>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        jni::make_jstring(value.key)
      );
    }
  };

} // namespace margelo::nitro::keychainmodule
