///
/// JThemeSettings.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 "ThemeSettings.hpp"

#include <optional>
#include <string>

namespace margelo::nitro::taponpagseguro {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct ThemeSettings by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    ThemeSettings toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldToolbar_text_color = clazz->getField<jni::JString>("toolbar_text_color");
      jni::local_ref<jni::JString> toolbar_text_color = this->getFieldValue(fieldToolbar_text_color);
      static const auto fieldToolbar_color = clazz->getField<jni::JString>("toolbar_color");
      jni::local_ref<jni::JString> toolbar_color = this->getFieldValue(fieldToolbar_color);
      static const auto fieldStatus_bar_color = clazz->getField<jni::JString>("status_bar_color");
      jni::local_ref<jni::JString> status_bar_color = this->getFieldValue(fieldStatus_bar_color);
      static const auto fieldButton_background_color = clazz->getField<jni::JString>("button_background_color");
      jni::local_ref<jni::JString> button_background_color = this->getFieldValue(fieldButton_background_color);
      static const auto fieldButton_text_color = clazz->getField<jni::JString>("button_text_color");
      jni::local_ref<jni::JString> button_text_color = this->getFieldValue(fieldButton_text_color);
      return ThemeSettings(
        toolbar_text_color != nullptr ? std::make_optional(toolbar_text_color->toStdString()) : std::nullopt,
        toolbar_color != nullptr ? std::make_optional(toolbar_color->toStdString()) : std::nullopt,
        status_bar_color != nullptr ? std::make_optional(status_bar_color->toStdString()) : std::nullopt,
        button_background_color != nullptr ? std::make_optional(button_background_color->toStdString()) : std::nullopt,
        button_text_color != nullptr ? std::make_optional(button_text_color->toStdString()) : 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<JThemeSettings::javaobject> fromCpp(const ThemeSettings& value) {
      using JSignature = JThemeSettings(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.toolbar_text_color.has_value() ? jni::make_jstring(value.toolbar_text_color.value()) : nullptr,
        value.toolbar_color.has_value() ? jni::make_jstring(value.toolbar_color.value()) : nullptr,
        value.status_bar_color.has_value() ? jni::make_jstring(value.status_bar_color.value()) : nullptr,
        value.button_background_color.has_value() ? jni::make_jstring(value.button_background_color.value()) : nullptr,
        value.button_text_color.has_value() ? jni::make_jstring(value.button_text_color.value()) : nullptr
      );
    }
  };

} // namespace margelo::nitro::taponpagseguro
