///
/// JPhotoLibraryAlbum.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 "PhotoLibraryAlbum.hpp"

#include <string>

namespace margelo::nitro::one {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct PhotoLibraryAlbum by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    PhotoLibraryAlbum 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 fieldTitle = clazz->getField<jni::JString>("title");
      jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
      return PhotoLibraryAlbum(
        identifier->toStdString(),
        title->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<JPhotoLibraryAlbum::javaobject> fromCpp(const PhotoLibraryAlbum& value) {
      using JSignature = JPhotoLibraryAlbum(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,
        jni::make_jstring(value.identifier),
        jni::make_jstring(value.title)
      );
    }
  };

} // namespace margelo::nitro::one
