///
/// JClipboardImageResult.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 "ClipboardImageResult.hpp"

#include <string>

namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct ClipboardImageResult by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    ClipboardImageResult toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldData = clazz->getField<jni::JString>("data");
      jni::local_ref<jni::JString> data = this->getFieldValue(fieldData);
      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 ClipboardImageResult(
        data->toStdString(),
        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<JClipboardImageResult::javaobject> fromCpp(const ClipboardImageResult& value) {
      using JSignature = JClipboardImageResult(jni::alias_ref<jni::JString>, double, double);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        jni::make_jstring(value.data),
        value.width,
        value.height
      );
    }
  };

} // namespace margelo::nitro::one
