/**
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * @generated by codegen project: GenerateModuleH.js
 */

#pragma once

#include <ReactCommon/TurboModule.h>
#include <react/bridging/Bridging.h>

namespace facebook::react {


  class JSI_EXPORT NativeReactNativeLocalDownloadCxxSpecJSI : public TurboModule {
protected:
  NativeReactNativeLocalDownloadCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);

public:
  virtual jsi::Value localDownload(jsi::Runtime &rt, jsi::String uri) = 0;
  virtual jsi::Value getContentFd(jsi::Runtime &rt, jsi::String uri) = 0;
  virtual jsi::Value closeFd(jsi::Runtime &rt, jsi::String fd) = 0;
  virtual jsi::Value persistContentPermission(jsi::Runtime &rt, jsi::String uri) = 0;
  virtual jsi::Value copyFileSAF(jsi::Runtime &rt, jsi::String sourceUri, jsi::String destPath) = 0;

};

template <typename T>
class JSI_EXPORT NativeReactNativeLocalDownloadCxxSpec : public TurboModule {
public:
  jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
    return delegate_.create(rt, propName);
  }

  std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
    return delegate_.getPropertyNames(runtime);
  }

  static constexpr std::string_view kModuleName = "ReactNativeLocalDownload";

protected:
  NativeReactNativeLocalDownloadCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
    : TurboModule(std::string{NativeReactNativeLocalDownloadCxxSpec::kModuleName}, jsInvoker),
      delegate_(reinterpret_cast<T*>(this), jsInvoker) {}


private:
  class Delegate : public NativeReactNativeLocalDownloadCxxSpecJSI {
  public:
    Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
      NativeReactNativeLocalDownloadCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {

    }

    jsi::Value localDownload(jsi::Runtime &rt, jsi::String uri) override {
      static_assert(
          bridging::getParameterCount(&T::localDownload) == 2,
          "Expected localDownload(...) to have 2 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::localDownload, jsInvoker_, instance_, std::move(uri));
    }
    jsi::Value getContentFd(jsi::Runtime &rt, jsi::String uri) override {
      static_assert(
          bridging::getParameterCount(&T::getContentFd) == 2,
          "Expected getContentFd(...) to have 2 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::getContentFd, jsInvoker_, instance_, std::move(uri));
    }
    jsi::Value closeFd(jsi::Runtime &rt, jsi::String fd) override {
      static_assert(
          bridging::getParameterCount(&T::closeFd) == 2,
          "Expected closeFd(...) to have 2 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::closeFd, jsInvoker_, instance_, std::move(fd));
    }
    jsi::Value persistContentPermission(jsi::Runtime &rt, jsi::String uri) override {
      static_assert(
          bridging::getParameterCount(&T::persistContentPermission) == 2,
          "Expected persistContentPermission(...) to have 2 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::persistContentPermission, jsInvoker_, instance_, std::move(uri));
    }
    jsi::Value copyFileSAF(jsi::Runtime &rt, jsi::String sourceUri, jsi::String destPath) override {
      static_assert(
          bridging::getParameterCount(&T::copyFileSAF) == 3,
          "Expected copyFileSAF(...) to have 3 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::copyFileSAF, jsInvoker_, instance_, std::move(sourceUri), std::move(destPath));
    }

  private:
    friend class NativeReactNativeLocalDownloadCxxSpec;
    T *instance_;
  };

  Delegate delegate_;
};

} // namespace facebook::react
