///
/// JFiredTimerEvent.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 "FiredTimerEvent.hpp"

#include "FiredTimerType.hpp"
#include "JFiredTimerType.hpp"

namespace margelo::nitro::backgroundtimer {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct FiredTimerEvent by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    FiredTimerEvent toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldId = clazz->getField<double>("id");
      double id = this->getFieldValue(fieldId);
      static const auto fieldType = clazz->getField<JFiredTimerType>("type");
      jni::local_ref<JFiredTimerType> type = this->getFieldValue(fieldType);
      static const auto fieldSequence = clazz->getField<double>("sequence");
      double sequence = this->getFieldValue(fieldSequence);
      return FiredTimerEvent(
        id,
        type->toCpp(),
        sequence
      );
    }

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

} // namespace margelo::nitro::backgroundtimer
