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

#include "JHybridNativeLinearListLayoutSpec.hpp"

// Forward declaration of `NativeLinearListLayoutConfig` to properly resolve imports.
namespace margelo::nitro::reactnativelist { struct NativeLinearListLayoutConfig; }
// Forward declaration of `NativeLinearListLayoutIOSConfig` to properly resolve imports.
namespace margelo::nitro::reactnativelist { struct NativeLinearListLayoutIOSConfig; }
// Forward declaration of `NativeItemSizeEstimate` to properly resolve imports.
namespace margelo::nitro::reactnativelist { struct NativeItemSizeEstimate; }

#include "NativeLinearListLayoutConfig.hpp"
#include "JNativeLinearListLayoutConfig.hpp"
#include "NativeLinearListLayoutIOSConfig.hpp"
#include <optional>
#include "JNativeLinearListLayoutIOSConfig.hpp"
#include "NativeItemSizeEstimate.hpp"
#include "JNativeItemSizeEstimate.hpp"

namespace margelo::nitro::reactnativelist {

  std::shared_ptr<JHybridNativeLinearListLayoutSpec> JHybridNativeLinearListLayoutSpec::JavaPart::getJHybridNativeLinearListLayoutSpec() {
    auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
    auto castHybridObject = std::dynamic_pointer_cast<JHybridNativeLinearListLayoutSpec>(hybridObject);
    if (castHybridObject == nullptr) [[unlikely]] {
      throw std::runtime_error("Failed to downcast JHybridObject to JHybridNativeLinearListLayoutSpec!");
    }
    return castHybridObject;
  }

  jni::local_ref<JHybridNativeLinearListLayoutSpec::CxxPart::jhybriddata> JHybridNativeLinearListLayoutSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
    return makeCxxInstance(jThis);
  }

  std::shared_ptr<JHybridObject> JHybridNativeLinearListLayoutSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
    auto castJavaPart = jni::dynamic_ref_cast<JHybridNativeLinearListLayoutSpec::JavaPart>(javaPart);
    if (castJavaPart == nullptr) [[unlikely]] {
      throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridNativeLinearListLayoutSpec::JavaPart!");
    }
    return std::make_shared<JHybridNativeLinearListLayoutSpec>(castJavaPart);
  }

  void JHybridNativeLinearListLayoutSpec::CxxPart::registerNatives() {
    registerHybrid({
      makeNativeMethod("initHybrid", JHybridNativeLinearListLayoutSpec::CxxPart::initHybrid),
    });
  }

  // Properties
  

  // Methods
  void JHybridNativeLinearListLayoutSpec::setConfig(const NativeLinearListLayoutConfig& config) {
    static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNativeLinearListLayoutConfig> /* config */)>("setConfig");
    method(_javaPart, JNativeLinearListLayoutConfig::fromCpp(config));
  }

} // namespace margelo::nitro::reactnativelist
