///
/// JTrackFrame.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 "TrackFrame.hpp"



namespace margelo::nitro::videopipeline {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct TrackFrame by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    TrackFrame toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldX = clazz->getField<double>("x");
      double x = this->getFieldValue(fieldX);
      static const auto fieldY = clazz->getField<double>("y");
      double y = this->getFieldValue(fieldY);
      static const auto fieldW = clazz->getField<double>("w");
      double w = this->getFieldValue(fieldW);
      static const auto fieldH = clazz->getField<double>("h");
      double h = this->getFieldValue(fieldH);
      return TrackFrame(
        x,
        y,
        w,
        h
      );
    }

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

} // namespace margelo::nitro::videopipeline
