///
/// JPixelFormatConstraint.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 "PixelFormatConstraint.hpp"

#include "JPixelFormat.hpp"
#include "PixelFormat.hpp"

namespace margelo::nitro::camera {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct PixelFormatConstraint by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    PixelFormatConstraint toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldPixelFormat = clazz->getField<JPixelFormat>("pixelFormat");
      jni::local_ref<JPixelFormat> pixelFormat = this->getFieldValue(fieldPixelFormat);
      return PixelFormatConstraint(
        pixelFormat->toCpp()
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JPixelFormatConstraint::javaobject> fromCpp(const PixelFormatConstraint& value) {
      using JSignature = JPixelFormatConstraint(jni::alias_ref<JPixelFormat>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        JPixelFormat::fromCpp(value.pixelFormat)
      );
    }
  };

} // namespace margelo::nitro::camera
