///
/// JDimensions.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 "Dimensions.hpp"



namespace margelo::nitro::unistyles {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct Dimensions by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    Dimensions toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldWidth = clazz->getField<double>("width");
      double width = this->getFieldValue(fieldWidth);
      static const auto fieldHeight = clazz->getField<double>("height");
      double height = this->getFieldValue(fieldHeight);
      return Dimensions(
        width,
        height
      );
    }

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

} // namespace margelo::nitro::unistyles
