///
/// JImageTransformResult.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 "ImageTransformResult.hpp"

#include <string>

namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct ImageTransformResult by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    ImageTransformResult toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldUri = clazz->getField<jni::JString>("uri");
      jni::local_ref<jni::JString> uri = this->getFieldValue(fieldUri);
      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);
      static const auto fieldSize = clazz->getField<double>("size");
      double size = this->getFieldValue(fieldSize);
      return ImageTransformResult(
        uri->toStdString(),
        width,
        height,
        size
      );
    }

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

} // namespace margelo::nitro::one
