///
/// JTextToSpeechVoice.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2024 Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "TextToSpeechVoice.hpp"

#include <string>

namespace margelo::nitro::nitrotexttospeech {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct TextToSpeechVoice by copying all values to C++.
     */
    [[maybe_unused]]
    TextToSpeechVoice toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldIdentifier = clazz->getField<jni::JString>("identifier");
      jni::local_ref<jni::JString> identifier = this->getFieldValue(fieldIdentifier);
      static const auto fieldName = clazz->getField<jni::JString>("name");
      jni::local_ref<jni::JString> name = this->getFieldValue(fieldName);
      static const auto fieldQuality = clazz->getField<jni::JString>("quality");
      jni::local_ref<jni::JString> quality = this->getFieldValue(fieldQuality);
      static const auto fieldGender = clazz->getField<jni::JString>("gender");
      jni::local_ref<jni::JString> gender = this->getFieldValue(fieldGender);
      return TextToSpeechVoice(
        identifier->toStdString(),
        name->toStdString(),
        quality->toStdString(),
        gender->toStdString()
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JTextToSpeechVoice::javaobject> fromCpp(const TextToSpeechVoice& value) {
      return newInstance(
        jni::make_jstring(value.identifier),
        jni::make_jstring(value.name),
        jni::make_jstring(value.quality),
        jni::make_jstring(value.gender)
      );
    }
  };

} // namespace margelo::nitro::nitrotexttospeech
