///
/// JUnistylesNativeMiniRuntime.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 "UnistylesNativeMiniRuntime.hpp"

#include "ColorScheme.hpp"
#include "Dimensions.hpp"
#include "Insets.hpp"
#include "JColorScheme.hpp"
#include "JDimensions.hpp"
#include "JInsets.hpp"
#include <string>

namespace margelo::nitro::unistyles {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct UnistylesNativeMiniRuntime by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    UnistylesNativeMiniRuntime toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldColorScheme = clazz->getField<JColorScheme>("colorScheme");
      jni::local_ref<JColorScheme> colorScheme = this->getFieldValue(fieldColorScheme);
      static const auto fieldScreen = clazz->getField<JDimensions>("screen");
      jni::local_ref<JDimensions> screen = this->getFieldValue(fieldScreen);
      static const auto fieldContentSizeCategory = clazz->getField<jni::JString>("contentSizeCategory");
      jni::local_ref<jni::JString> contentSizeCategory = this->getFieldValue(fieldContentSizeCategory);
      static const auto fieldInsets = clazz->getField<JInsets>("insets");
      jni::local_ref<JInsets> insets = this->getFieldValue(fieldInsets);
      static const auto fieldPixelRatio = clazz->getField<double>("pixelRatio");
      double pixelRatio = this->getFieldValue(fieldPixelRatio);
      static const auto fieldFontScale = clazz->getField<double>("fontScale");
      double fontScale = this->getFieldValue(fieldFontScale);
      static const auto fieldRtl = clazz->getField<jboolean>("rtl");
      jboolean rtl = this->getFieldValue(fieldRtl);
      static const auto fieldStatusBar = clazz->getField<JDimensions>("statusBar");
      jni::local_ref<JDimensions> statusBar = this->getFieldValue(fieldStatusBar);
      static const auto fieldNavigationBar = clazz->getField<JDimensions>("navigationBar");
      jni::local_ref<JDimensions> navigationBar = this->getFieldValue(fieldNavigationBar);
      static const auto fieldIsPortrait = clazz->getField<jboolean>("isPortrait");
      jboolean isPortrait = this->getFieldValue(fieldIsPortrait);
      static const auto fieldIsLandscape = clazz->getField<jboolean>("isLandscape");
      jboolean isLandscape = this->getFieldValue(fieldIsLandscape);
      return UnistylesNativeMiniRuntime(
        colorScheme->toCpp(),
        screen->toCpp(),
        contentSizeCategory->toStdString(),
        insets->toCpp(),
        pixelRatio,
        fontScale,
        static_cast<bool>(rtl),
        statusBar->toCpp(),
        navigationBar->toCpp(),
        static_cast<bool>(isPortrait),
        static_cast<bool>(isLandscape)
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JUnistylesNativeMiniRuntime::javaobject> fromCpp(const UnistylesNativeMiniRuntime& value) {
      using JSignature = JUnistylesNativeMiniRuntime(jni::alias_ref<JColorScheme>, jni::alias_ref<JDimensions>, jni::alias_ref<jni::JString>, jni::alias_ref<JInsets>, double, double, jboolean, jni::alias_ref<JDimensions>, jni::alias_ref<JDimensions>, jboolean, jboolean);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        JColorScheme::fromCpp(value.colorScheme),
        JDimensions::fromCpp(value.screen),
        jni::make_jstring(value.contentSizeCategory),
        JInsets::fromCpp(value.insets),
        value.pixelRatio,
        value.fontScale,
        value.rtl,
        JDimensions::fromCpp(value.statusBar),
        JDimensions::fromCpp(value.navigationBar),
        value.isPortrait,
        value.isLandscape
      );
    }
  };

} // namespace margelo::nitro::unistyles
