///
/// JWhiteBalanceGains.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 "WhiteBalanceGains.hpp"



namespace margelo::nitro::camera {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct WhiteBalanceGains by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    WhiteBalanceGains toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldRedGain = clazz->getField<double>("redGain");
      double redGain = this->getFieldValue(fieldRedGain);
      static const auto fieldBlueGain = clazz->getField<double>("blueGain");
      double blueGain = this->getFieldValue(fieldBlueGain);
      static const auto fieldGreenGain = clazz->getField<double>("greenGain");
      double greenGain = this->getFieldValue(fieldGreenGain);
      return WhiteBalanceGains(
        redGain,
        blueGain,
        greenGain
      );
    }

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

} // namespace margelo::nitro::camera
