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

#include "JHybridOneAppInfoSpec.hpp"



#include <string>
#include <optional>

namespace margelo::nitro::one {

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

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

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

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

  // Properties
  std::optional<std::string> JHybridOneAppInfoSpec::getVersion() {
    static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getVersion");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridOneAppInfoSpec::getBuild() {
    static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getBuild");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridOneAppInfoSpec::getApplicationId() {
    static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getApplicationId");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }

  // Methods
  

} // namespace margelo::nitro::one
