///
/// JSubtitleAssets.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 "SubtitleAssets.hpp"

#include "JJassubAssets.hpp"
#include "JPgsAssets.hpp"
#include "JassubAssets.hpp"
#include "PgsAssets.hpp"
#include <optional>
#include <string>

namespace margelo::nitro::omni {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct SubtitleAssets by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    SubtitleAssets toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldJassub = clazz->getField<JJassubAssets>("jassub");
      jni::local_ref<JJassubAssets> jassub = this->getFieldValue(fieldJassub);
      static const auto fieldPgs = clazz->getField<JPgsAssets>("pgs");
      jni::local_ref<JPgsAssets> pgs = this->getFieldValue(fieldPgs);
      return SubtitleAssets(
        jassub != nullptr ? std::make_optional(jassub->toCpp()) : std::nullopt,
        pgs != nullptr ? std::make_optional(pgs->toCpp()) : 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<JSubtitleAssets::javaobject> fromCpp(const SubtitleAssets& value) {
      using JSignature = JSubtitleAssets(jni::alias_ref<JJassubAssets>, jni::alias_ref<JPgsAssets>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.jassub.has_value() ? JJassubAssets::fromCpp(value.jassub.value()) : nullptr,
        value.pgs.has_value() ? JPgsAssets::fromCpp(value.pgs.value()) : nullptr
      );
    }
  };

} // namespace margelo::nitro::omni
