///
/// JTimedMetadataObject.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 "TimedMetadataObject.hpp"

#include <string>

namespace margelo::nitro::video {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct TimedMetadataObject by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    TimedMetadataObject toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldValue = clazz->getField<jni::JString>("value");
      jni::local_ref<jni::JString> value = this->getFieldValue(fieldValue);
      static const auto fieldIdentifier = clazz->getField<jni::JString>("identifier");
      jni::local_ref<jni::JString> identifier = this->getFieldValue(fieldIdentifier);
      return TimedMetadataObject(
        value->toStdString(),
        identifier->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<JTimedMetadataObject::javaobject> fromCpp(const TimedMetadataObject& value) {
      return newInstance(
        jni::make_jstring(value.value),
        jni::make_jstring(value.identifier)
      );
    }
  };

} // namespace margelo::nitro::video
