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

#pragma once

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

#include <string>

namespace margelo::nitro::fawrypay_rnfawrypaysdk {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct CustomerInfo by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    CustomerInfo toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldCustomerName = clazz->getField<jni::JString>("customerName");
      jni::local_ref<jni::JString> customerName = this->getFieldValue(fieldCustomerName);
      static const auto fieldCustomerMobile = clazz->getField<jni::JString>("customerMobile");
      jni::local_ref<jni::JString> customerMobile = this->getFieldValue(fieldCustomerMobile);
      static const auto fieldCustomerEmail = clazz->getField<jni::JString>("customerEmail");
      jni::local_ref<jni::JString> customerEmail = this->getFieldValue(fieldCustomerEmail);
      static const auto fieldCustomerProfileId = clazz->getField<jni::JString>("customerProfileId");
      jni::local_ref<jni::JString> customerProfileId = this->getFieldValue(fieldCustomerProfileId);
      return CustomerInfo(
        customerName->toStdString(),
        customerMobile->toStdString(),
        customerEmail->toStdString(),
        customerProfileId->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<JCustomerInfo::javaobject> fromCpp(const CustomerInfo& value) {
      return newInstance(
        jni::make_jstring(value.customerName),
        jni::make_jstring(value.customerMobile),
        jni::make_jstring(value.customerEmail),
        jni::make_jstring(value.customerProfileId)
      );
    }
  };

} // namespace margelo::nitro::fawrypay_rnfawrypaysdk
