///
/// JFullscreenConfig.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 "FullscreenConfig.hpp"

#include <optional>

namespace margelo::nitro::aviation {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct FullscreenConfig by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    FullscreenConfig toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldAutoRotate = clazz->getField<jni::JBoolean>("autoRotate");
      jni::local_ref<jni::JBoolean> autoRotate = this->getFieldValue(fieldAutoRotate);
      return FullscreenConfig(
        autoRotate != nullptr ? std::make_optional(static_cast<bool>(autoRotate->value())) : std::nullopt
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JFullscreenConfig::javaobject> fromCpp(const FullscreenConfig& value) {
      using JSignature = JFullscreenConfig(jni::alias_ref<jni::JBoolean>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.autoRotate.has_value() ? jni::JBoolean::valueOf(value.autoRotate.value()) : nullptr
      );
    }
  };

} // namespace margelo::nitro::aviation
