///
/// JPrintResult.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 "PrintResult.hpp"



namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct PrintResult by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    PrintResult toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldCompleted = clazz->getField<jboolean>("completed");
      jboolean completed = this->getFieldValue(fieldCompleted);
      return PrintResult(
        static_cast<bool>(completed)
      );
    }

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

} // namespace margelo::nitro::one
