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

#include "JHybridNitroBatterySpec.hpp"



#include <string>
#include <functional>
#include "JFunc_void_std__string.hpp"
#include "JFunc_void.hpp"

namespace margelo::nitro::battery {

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

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

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

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

  // Properties
  

  // Methods
  double JHybridNitroBatterySpec::getLevel() {
    static const auto method = javaClassStatic()->getMethod<double()>("getLevel");
    auto __result = method(_javaPart);
    return __result;
  }
  bool JHybridNitroBatterySpec::isCharging() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("isCharging");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  std::string JHybridNitroBatterySpec::getBatteryState() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getBatteryState");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  bool JHybridNitroBatterySpec::isLowPowerModeEnabled() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("isLowPowerModeEnabled");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  void JHybridNitroBatterySpec::addBatteryStateListener(const std::function<void(const std::string& /* state */)>& listener) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* listener */)>("addBatteryStateListener_cxx");
    method(_javaPart, JFunc_void_std__string_cxx::fromCpp(listener));
  }
  void JHybridNitroBatterySpec::removeBatteryStateListener(const std::function<void(const std::string& /* state */)>& listener) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* listener */)>("removeBatteryStateListener_cxx");
    method(_javaPart, JFunc_void_std__string_cxx::fromCpp(listener));
  }
  void JHybridNitroBatterySpec::addLowPowerListener(const std::function<void()>& listener) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* listener */)>("addLowPowerListener_cxx");
    method(_javaPart, JFunc_void_cxx::fromCpp(listener));
  }
  void JHybridNitroBatterySpec::removeLowPowerListener(const std::function<void()>& listener) {
    static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* listener */)>("removeLowPowerListener_cxx");
    method(_javaPart, JFunc_void_cxx::fromCpp(listener));
  }

} // namespace margelo::nitro::battery
