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

#pragma once

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

#include <string>

namespace margelo::nitro::video {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct OnGetLicensePayload by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    OnGetLicensePayload toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldContentId = clazz->getField<jni::JString>("contentId");
      jni::local_ref<jni::JString> contentId = this->getFieldValue(fieldContentId);
      static const auto fieldLicenseUrl = clazz->getField<jni::JString>("licenseUrl");
      jni::local_ref<jni::JString> licenseUrl = this->getFieldValue(fieldLicenseUrl);
      static const auto fieldKeyUrl = clazz->getField<jni::JString>("keyUrl");
      jni::local_ref<jni::JString> keyUrl = this->getFieldValue(fieldKeyUrl);
      static const auto fieldSpc = clazz->getField<jni::JString>("spc");
      jni::local_ref<jni::JString> spc = this->getFieldValue(fieldSpc);
      return OnGetLicensePayload(
        contentId->toStdString(),
        licenseUrl->toStdString(),
        keyUrl->toStdString(),
        spc->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<JOnGetLicensePayload::javaobject> fromCpp(const OnGetLicensePayload& value) {
      return newInstance(
        jni::make_jstring(value.contentId),
        jni::make_jstring(value.licenseUrl),
        jni::make_jstring(value.keyUrl),
        jni::make_jstring(value.spc)
      );
    }
  };

} // namespace margelo::nitro::video
