///
/// JRotationResult.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 "RotationResult.hpp"



namespace margelo::nitro::sensitiveinfo {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct RotationResult by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    RotationResult toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldPreviousVersion = clazz->getField<double>("previousVersion");
      double previousVersion = this->getFieldValue(fieldPreviousVersion);
      static const auto fieldNewVersion = clazz->getField<double>("newVersion");
      double newVersion = this->getFieldValue(fieldNewVersion);
      static const auto fieldReEncryptedCount = clazz->getField<double>("reEncryptedCount");
      double reEncryptedCount = this->getFieldValue(fieldReEncryptedCount);
      return RotationResult(
        previousVersion,
        newVersion,
        reEncryptedCount
      );
    }

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

} // namespace margelo::nitro::sensitiveinfo
