///
/// JNitroReceiptValidationAppleOptions.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 "NitroReceiptValidationAppleOptions.hpp"

#include <string>

namespace margelo::nitro::iap {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct NitroReceiptValidationAppleOptions by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    NitroReceiptValidationAppleOptions toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldSku = clazz->getField<jni::JString>("sku");
      jni::local_ref<jni::JString> sku = this->getFieldValue(fieldSku);
      return NitroReceiptValidationAppleOptions(
        sku->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<JNitroReceiptValidationAppleOptions::javaobject> fromCpp(const NitroReceiptValidationAppleOptions& value) {
      using JSignature = JNitroReceiptValidationAppleOptions(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.sku)
      );
    }
  };

} // namespace margelo::nitro::iap
