/**
 * 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 NativeTurboEncryptionCxxSpecJSI : public TurboModule {
protected:
  NativeTurboEncryptionCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);

public:
  virtual jsi::String encrypt(jsi::Runtime &rt, jsi::String plainText, jsi::String key) = 0;
  virtual jsi::String decrypt(jsi::Runtime &rt, jsi::String encryptedText, jsi::String key) = 0;
  virtual jsi::Value decryptAsync(jsi::Runtime &rt, jsi::String encryptedText, jsi::String key) = 0;
  virtual jsi::Value encryptAsync(jsi::Runtime &rt, jsi::String plainText, jsi::String key) = 0;

};

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

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

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


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

    }

    jsi::String encrypt(jsi::Runtime &rt, jsi::String plainText, jsi::String key) override {
      static_assert(
          bridging::getParameterCount(&T::encrypt) == 3,
          "Expected encrypt(...) to have 3 parameters");

      return bridging::callFromJs<jsi::String>(
          rt, &T::encrypt, jsInvoker_, instance_, std::move(plainText), std::move(key));
    }
    jsi::String decrypt(jsi::Runtime &rt, jsi::String encryptedText, jsi::String key) override {
      static_assert(
          bridging::getParameterCount(&T::decrypt) == 3,
          "Expected decrypt(...) to have 3 parameters");

      return bridging::callFromJs<jsi::String>(
          rt, &T::decrypt, jsInvoker_, instance_, std::move(encryptedText), std::move(key));
    }
    jsi::Value decryptAsync(jsi::Runtime &rt, jsi::String encryptedText, jsi::String key) override {
      static_assert(
          bridging::getParameterCount(&T::decryptAsync) == 3,
          "Expected decryptAsync(...) to have 3 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::decryptAsync, jsInvoker_, instance_, std::move(encryptedText), std::move(key));
    }
    jsi::Value encryptAsync(jsi::Runtime &rt, jsi::String plainText, jsi::String key) override {
      static_assert(
          bridging::getParameterCount(&T::encryptAsync) == 3,
          "Expected encryptAsync(...) to have 3 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::encryptAsync, jsInvoker_, instance_, std::move(plainText), std::move(key));
    }

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

  Delegate delegate_;
};

} // namespace facebook::react
