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

#include "JHybridReactNativeBundleUpdateSpec.hpp"

// Forward declaration of `BundleDownloadResult` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleDownloadResult; }
// Forward declaration of `TestResult` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct TestResult; }
// Forward declaration of `FallbackBundleInfo` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct FallbackBundleInfo; }
// Forward declaration of `LocalBundleInfo` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct LocalBundleInfo; }
// Forward declaration of `AscFileInfo` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct AscFileInfo; }
// Forward declaration of `BundleDownloadParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleDownloadParams; }
// Forward declaration of `BundleVerifyParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleVerifyParams; }
// Forward declaration of `BundleVerifyASCParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleVerifyASCParams; }
// Forward declaration of `BundleDownloadASCParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleDownloadASCParams; }
// Forward declaration of `BundleInstallParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleInstallParams; }
// Forward declaration of `BundleSwitchParams` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleSwitchParams; }
// Forward declaration of `BundleDownloadEvent` to properly resolve imports.
namespace margelo::nitro::reactnativebundleupdate { struct BundleDownloadEvent; }

#include "BundleDownloadResult.hpp"
#include <NitroModules/Promise.hpp>
#include <NitroModules/JPromise.hpp>
#include "JBundleDownloadResult.hpp"
#include <string>
#include "TestResult.hpp"
#include "JTestResult.hpp"
#include "FallbackBundleInfo.hpp"
#include <vector>
#include "JFallbackBundleInfo.hpp"
#include "LocalBundleInfo.hpp"
#include "JLocalBundleInfo.hpp"
#include "AscFileInfo.hpp"
#include "JAscFileInfo.hpp"
#include "BundleDownloadParams.hpp"
#include "JBundleDownloadParams.hpp"
#include "BundleVerifyParams.hpp"
#include "JBundleVerifyParams.hpp"
#include "BundleVerifyASCParams.hpp"
#include "JBundleVerifyASCParams.hpp"
#include "BundleDownloadASCParams.hpp"
#include "JBundleDownloadASCParams.hpp"
#include "BundleInstallParams.hpp"
#include "JBundleInstallParams.hpp"
#include "BundleSwitchParams.hpp"
#include "JBundleSwitchParams.hpp"
#include "BundleDownloadEvent.hpp"
#include <functional>
#include "JFunc_void_BundleDownloadEvent.hpp"
#include <NitroModules/JNICallable.hpp>
#include "JBundleDownloadEvent.hpp"

namespace margelo::nitro::reactnativebundleupdate {

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

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

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

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

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

  // Properties
  

  // Methods
  std::shared_ptr<Promise<BundleDownloadResult>> JHybridReactNativeBundleUpdateSpec::downloadBundle(const BundleDownloadParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleDownloadParams> /* params */)>("downloadBundle");
    auto __result = method(_javaPart, JBundleDownloadParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<BundleDownloadResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JBundleDownloadResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::verifyBundle(const BundleVerifyParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleVerifyParams> /* params */)>("verifyBundle");
    auto __result = method(_javaPart, JBundleVerifyParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::verifyBundleASC(const BundleVerifyASCParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleVerifyASCParams> /* params */)>("verifyBundleASC");
    auto __result = method(_javaPart, JBundleVerifyASCParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::downloadBundleASC(const BundleDownloadASCParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleDownloadASCParams> /* params */)>("downloadBundleASC");
    auto __result = method(_javaPart, JBundleDownloadASCParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::installBundle(const BundleInstallParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleInstallParams> /* params */)>("installBundle");
    auto __result = method(_javaPart, JBundleInstallParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::clearDownload() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearDownload");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::clearBundle() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearBundle");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<TestResult>> JHybridReactNativeBundleUpdateSpec::clearAllJSBundleData() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearAllJSBundleData");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<TestResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JTestResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::resetToBuiltInBundle() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("resetToBuiltInBundle");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::vector<FallbackBundleInfo>>> JHybridReactNativeBundleUpdateSpec::getFallbackUpdateBundleData() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getFallbackUpdateBundleData");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::vector<FallbackBundleInfo>>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JArrayClass<JFallbackBundleInfo>>(__boxedResult);
        __promise->resolve([&]() {
          size_t __size = __result->size();
          std::vector<FallbackBundleInfo> __vector;
          __vector.reserve(__size);
          for (size_t __i = 0; __i < __size; __i++) {
            auto __element = __result->getElement(__i);
            __vector.push_back(__element->toCpp());
          }
          return __vector;
        }());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::setCurrentUpdateBundleData(const BundleSwitchParams& params) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JBundleSwitchParams> /* params */)>("setCurrentUpdateBundleData");
    auto __result = method(_javaPart, JBundleSwitchParams::fromCpp(params));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::string JHybridReactNativeBundleUpdateSpec::getWebEmbedPath() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getWebEmbedPath");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getWebEmbedPathAsync() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getWebEmbedPathAsync");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::string JHybridReactNativeBundleUpdateSpec::getJsBundlePath() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getJsBundlePath");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getJsBundlePathAsync() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getJsBundlePathAsync");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::string JHybridReactNativeBundleUpdateSpec::getBackgroundJsBundlePath() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getBackgroundJsBundlePath");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getBackgroundJsBundlePathAsync() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getBackgroundJsBundlePathAsync");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getNativeAppVersion() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getNativeAppVersion");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getNativeBuildNumber() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getNativeBuildNumber");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getBuiltinBundleVersion() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getBuiltinBundleVersion");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleUpdateSpec::testVerification() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("testVerification");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<bool>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
        __promise->resolve(static_cast<bool>(__result->value()));
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleUpdateSpec::testSkipVerification() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("testSkipVerification");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<bool>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
        __promise->resolve(static_cast<bool>(__result->value()));
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  bool JHybridReactNativeBundleUpdateSpec::isSkipGpgVerificationAllowed() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("isSkipGpgVerificationAllowed");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleUpdateSpec::isBundleExists(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("isBundleExists");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<bool>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
        __promise->resolve(static_cast<bool>(__result->value()));
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<void>> JHybridReactNativeBundleUpdateSpec::verifyExtractedBundle(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("verifyExtractedBundle");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<void>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
        __promise->resolve();
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::vector<LocalBundleInfo>>> JHybridReactNativeBundleUpdateSpec::listLocalBundles() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("listLocalBundles");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::vector<LocalBundleInfo>>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JArrayClass<JLocalBundleInfo>>(__boxedResult);
        __promise->resolve([&]() {
          size_t __size = __result->size();
          std::vector<LocalBundleInfo> __vector;
          __vector.reserve(__size);
          for (size_t __i = 0; __i < __size; __i++) {
            auto __element = __result->getElement(__i);
            __vector.push_back(__element->toCpp());
          }
          return __vector;
        }());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::vector<AscFileInfo>>> JHybridReactNativeBundleUpdateSpec::listAscFiles() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("listAscFiles");
    auto __result = method(_javaPart);
    return [&]() {
      auto __promise = Promise<std::vector<AscFileInfo>>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JArrayClass<JAscFileInfo>>(__boxedResult);
        __promise->resolve([&]() {
          size_t __size = __result->size();
          std::vector<AscFileInfo> __vector;
          __vector.reserve(__size);
          for (size_t __i = 0; __i < __size; __i++) {
            auto __element = __result->getElement(__i);
            __vector.push_back(__element->toCpp());
          }
          return __vector;
        }());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<std::string>> JHybridReactNativeBundleUpdateSpec::getSha256FromFilePath(const std::string& filePath) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* filePath */)>("getSha256FromFilePath");
    auto __result = method(_javaPart, jni::make_jstring(filePath));
    return [&]() {
      auto __promise = Promise<std::string>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
        __promise->resolve(__result->toStdString());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<TestResult>> JHybridReactNativeBundleUpdateSpec::testDeleteJsBundle(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("testDeleteJsBundle");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<TestResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JTestResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<TestResult>> JHybridReactNativeBundleUpdateSpec::testDeleteJsRuntimeDir(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("testDeleteJsRuntimeDir");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<TestResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JTestResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<TestResult>> JHybridReactNativeBundleUpdateSpec::testDeleteMetadataJson(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("testDeleteMetadataJson");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<TestResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JTestResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  std::shared_ptr<Promise<TestResult>> JHybridReactNativeBundleUpdateSpec::testWriteEmptyMetadataJson(const std::string& appVersion, const std::string& bundleVersion) {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("testWriteEmptyMetadataJson");
    auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
    return [&]() {
      auto __promise = Promise<TestResult>::create();
      __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
        auto __result = jni::static_ref_cast<JTestResult>(__boxedResult);
        __promise->resolve(__result->toCpp());
      });
      __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
        jni::JniException __jniError(__throwable);
        __promise->reject(std::make_exception_ptr(__jniError));
      });
      return __promise;
    }();
  }
  double JHybridReactNativeBundleUpdateSpec::addDownloadListener(const std::function<void(const BundleDownloadEvent& /* event */)>& callback) {
    static const auto method = javaClassStatic()->getMethod<double(jni::alias_ref<JFunc_void_BundleDownloadEvent::javaobject> /* callback */)>("addDownloadListener_cxx");
    auto __result = method(_javaPart, JFunc_void_BundleDownloadEvent_cxx::fromCpp(callback));
    return __result;
  }
  void JHybridReactNativeBundleUpdateSpec::removeDownloadListener(double id) {
    static const auto method = javaClassStatic()->getMethod<void(double /* id */)>("removeDownloadListener");
    method(_javaPart, id);
  }

} // namespace margelo::nitro::reactnativebundleupdate
