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

#include "JHybridNitroVtoViewSpec.hpp"



#include <string>
#include <functional>
#include <optional>
#include "JFunc_void_std__string.hpp"
#include <NitroModules/JNICallable.hpp>
#include "JFunc_void.hpp"

namespace margelo::nitro::nitrovto {

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

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

  size_t JHybridNitroVtoViewSpec::getExternalMemorySize() noexcept {
    static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
    return method(_javaPart);
  }

  void JHybridNitroVtoViewSpec::dispose() noexcept {
    static const auto method = javaClassStatic()->getMethod<void()>("dispose");
    method(_javaPart);
  }

  std::string JHybridNitroVtoViewSpec::toString() {
    static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
    auto javaString = method(_javaPart);
    return javaString->toStdString();
  }

  // Properties
  std::string JHybridNitroVtoViewSpec::getModelUrl() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getModelUrl");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  void JHybridNitroVtoViewSpec::setModelUrl(const std::string& modelUrl) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* modelUrl */)>("setModelUrl");
    method(_javaPart, jni::make_jstring(modelUrl));
  }
  bool JHybridNitroVtoViewSpec::getIsActive() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("isActive");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  void JHybridNitroVtoViewSpec::setIsActive(bool isActive) {
    static const auto method = javaClassStatic()->getMethod<void(jboolean /* isActive */)>("setActive");
    method(_javaPart, isActive);
  }
  std::optional<std::function<void(const std::string& /* modelUrl */)>> JHybridNitroVtoViewSpec::getOnModelLoaded() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnModelLoaded_cxx");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* modelUrl */)> {
      if (__result->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
        auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(__result);
        return downcast->cthis()->getFunction();
      } else {
        auto __resultRef = jni::make_global(__result);
        return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(__resultRef));
      }
    }()) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setOnModelLoaded(const std::optional<std::function<void(const std::string& /* modelUrl */)>>& onModelLoaded) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onModelLoaded */)>("setOnModelLoaded_cxx");
    method(_javaPart, onModelLoaded.has_value() ? JFunc_void_std__string_cxx::fromCpp(onModelLoaded.value()) : nullptr);
  }
  std::optional<std::function<void()>> JHybridNitroVtoViewSpec::getOnFaceTracked() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>()>("getOnFaceTracked_cxx");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional([&]() -> std::function<void()> {
      if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
        auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
        return downcast->cthis()->getFunction();
      } else {
        auto __resultRef = jni::make_global(__result);
        return JNICallable<JFunc_void, void()>(std::move(__resultRef));
      }
    }()) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setOnFaceTracked(const std::optional<std::function<void()>>& onFaceTracked) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* onFaceTracked */)>("setOnFaceTracked_cxx");
    method(_javaPart, onFaceTracked.has_value() ? JFunc_void_cxx::fromCpp(onFaceTracked.value()) : nullptr);
  }
  std::optional<std::function<void(const std::string& /* modelUrl */)>> JHybridNitroVtoViewSpec::getOnGlassesDisplayed() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnGlassesDisplayed_cxx");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* modelUrl */)> {
      if (__result->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
        auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(__result);
        return downcast->cthis()->getFunction();
      } else {
        auto __resultRef = jni::make_global(__result);
        return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(__resultRef));
      }
    }()) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setOnGlassesDisplayed(const std::optional<std::function<void(const std::string& /* modelUrl */)>>& onGlassesDisplayed) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onGlassesDisplayed */)>("setOnGlassesDisplayed_cxx");
    method(_javaPart, onGlassesDisplayed.has_value() ? JFunc_void_std__string_cxx::fromCpp(onGlassesDisplayed.value()) : nullptr);
  }
  std::optional<double> JHybridNitroVtoViewSpec::getForwardOffset() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getForwardOffset");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setForwardOffset(std::optional<double> forwardOffset) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* forwardOffset */)>("setForwardOffset");
    method(_javaPart, forwardOffset.has_value() ? jni::JDouble::valueOf(forwardOffset.value()) : nullptr);
  }
  std::optional<bool> JHybridNitroVtoViewSpec::getDebug() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getDebug");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setDebug(std::optional<bool> debug) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* debug */)>("setDebug");
    method(_javaPart, debug.has_value() ? jni::JBoolean::valueOf(debug.value()) : nullptr);
  }
  std::optional<bool> JHybridNitroVtoViewSpec::getShowNativeFPS() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getShowNativeFPS");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
  }
  void JHybridNitroVtoViewSpec::setShowNativeFPS(std::optional<bool> showNativeFPS) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* showNativeFPS */)>("setShowNativeFPS");
    method(_javaPart, showNativeFPS.has_value() ? jni::JBoolean::valueOf(showNativeFPS.value()) : nullptr);
  }
  bool JHybridNitroVtoViewSpec::getIsClipOn() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("isClipOn");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  void JHybridNitroVtoViewSpec::setIsClipOn(bool isClipOn) {
    static const auto method = javaClassStatic()->getMethod<void(jboolean /* isClipOn */)>("setClipOn");
    method(_javaPart, isClipOn);
  }

  // Methods
  void JHybridNitroVtoViewSpec::hideGlasses() {
    static const auto method = javaClassStatic()->getMethod<void()>("hideGlasses");
    method(_javaPart);
  }
  void JHybridNitroVtoViewSpec::showGlasses() {
    static const auto method = javaClassStatic()->getMethod<void()>("showGlasses");
    method(_javaPart);
  }

} // namespace margelo::nitro::nitrovto
