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

#pragma once

#include <NitroModules/JHybridObject.hpp>
#include <fbjni/fbjni.h>
#include "HybridReactNativeBundleUpdateSpec.hpp"




namespace margelo::nitro::reactnativebundleupdate {

  using namespace facebook;

  class JHybridReactNativeBundleUpdateSpec: public jni::HybridClass<JHybridReactNativeBundleUpdateSpec, JHybridObject>,
                                            public virtual HybridReactNativeBundleUpdateSpec {
  public:
    static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativebundleupdate/HybridReactNativeBundleUpdateSpec;";
    static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
    static void registerNatives();

  protected:
    // C++ constructor (called from Java via `initHybrid()`)
    explicit JHybridReactNativeBundleUpdateSpec(jni::alias_ref<jhybridobject> jThis) :
      HybridObject(HybridReactNativeBundleUpdateSpec::TAG),
      HybridBase(jThis),
      _javaPart(jni::make_global(jThis)) {}

  public:
    ~JHybridReactNativeBundleUpdateSpec() override {
      // Hermes GC can destroy JS objects on a non-JNI Thread.
      jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
    }

  public:
    size_t getExternalMemorySize() noexcept override;
    void dispose() noexcept override;
    std::string toString() override;

  public:
    inline const jni::global_ref<JHybridReactNativeBundleUpdateSpec::javaobject>& getJavaPart() const noexcept {
      return _javaPart;
    }

  public:
    // Properties
    

  public:
    // Methods
    std::shared_ptr<Promise<BundleDownloadResult>> downloadBundle(const BundleDownloadParams& params) override;
    std::shared_ptr<Promise<void>> verifyBundle(const BundleVerifyParams& params) override;
    std::shared_ptr<Promise<void>> verifyBundleASC(const BundleVerifyASCParams& params) override;
    std::shared_ptr<Promise<void>> downloadBundleASC(const BundleDownloadASCParams& params) override;
    std::shared_ptr<Promise<void>> installBundle(const BundleInstallParams& params) override;
    std::shared_ptr<Promise<void>> clearBundle() override;
    std::shared_ptr<Promise<TestResult>> clearAllJSBundleData() override;
    std::shared_ptr<Promise<std::vector<FallbackBundleInfo>>> getFallbackUpdateBundleData() override;
    std::shared_ptr<Promise<void>> setCurrentUpdateBundleData(const BundleSwitchParams& params) override;
    std::string getWebEmbedPath() override;
    std::shared_ptr<Promise<std::string>> getWebEmbedPathAsync() override;
    std::shared_ptr<Promise<std::string>> getJsBundlePath() override;
    std::shared_ptr<Promise<std::string>> getNativeAppVersion() override;
    std::shared_ptr<Promise<bool>> testVerification() override;
    std::shared_ptr<Promise<bool>> isBundleExists(const std::string& appVersion, const std::string& bundleVersion) override;
    std::shared_ptr<Promise<void>> verifyExtractedBundle(const std::string& appVersion, const std::string& bundleVersion) override;
    std::shared_ptr<Promise<std::vector<LocalBundleInfo>>> listLocalBundles() override;
    std::shared_ptr<Promise<std::vector<AscFileInfo>>> listAscFiles() override;
    std::shared_ptr<Promise<std::string>> getSha256FromFilePath(const std::string& filePath) override;
    std::shared_ptr<Promise<TestResult>> testDeleteJsBundle(const std::string& appVersion, const std::string& bundleVersion) override;
    std::shared_ptr<Promise<TestResult>> testDeleteJsRuntimeDir(const std::string& appVersion, const std::string& bundleVersion) override;
    std::shared_ptr<Promise<TestResult>> testDeleteMetadataJson(const std::string& appVersion, const std::string& bundleVersion) override;
    std::shared_ptr<Promise<TestResult>> testWriteEmptyMetadataJson(const std::string& appVersion, const std::string& bundleVersion) override;
    double addDownloadListener(const std::function<void(const BundleDownloadEvent& /* event */)>& callback) override;
    void removeDownloadListener(double id) override;

  private:
    friend HybridBase;
    using HybridBase::HybridBase;
    jni::global_ref<JHybridReactNativeBundleUpdateSpec::javaobject> _javaPart;
  };

} // namespace margelo::nitro::reactnativebundleupdate
