///
/// JNativeNotificationRequest.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 "NativeNotificationRequest.hpp"

#include "JNativeContent.hpp"
#include "JNativeTrigger.hpp"
#include "JNativeTriggerType.hpp"
#include "NativeContent.hpp"
#include "NativeTrigger.hpp"
#include "NativeTriggerType.hpp"
#include <NitroModules/AnyMap.hpp>
#include <NitroModules/JAnyMap.hpp>
#include <optional>
#include <string>

namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct NativeNotificationRequest by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    NativeNotificationRequest toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldIdentifier = clazz->getField<jni::JString>("identifier");
      jni::local_ref<jni::JString> identifier = this->getFieldValue(fieldIdentifier);
      static const auto fieldContent = clazz->getField<JNativeContent>("content");
      jni::local_ref<JNativeContent> content = this->getFieldValue(fieldContent);
      static const auto fieldTrigger = clazz->getField<JNativeTrigger>("trigger");
      jni::local_ref<JNativeTrigger> trigger = this->getFieldValue(fieldTrigger);
      return NativeNotificationRequest(
        identifier->toStdString(),
        content->toCpp(),
        trigger->toCpp()
      );
    }

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

} // namespace margelo::nitro::one
