///
/// JResolution.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 "Resolution.hpp"



namespace margelo::nitro::video {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct Resolution by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    Resolution toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldWidth = clazz->getField<double>("width");
      double width = this->getFieldValue(fieldWidth);
      static const auto fieldHeight = clazz->getField<double>("height");
      double height = this->getFieldValue(fieldHeight);
      return Resolution(
        width,
        height
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JResolution::javaobject> fromCpp(const Resolution& value) {
      return newInstance(
        value.width,
        value.height
      );
    }
  };

} // namespace margelo::nitro::video
