/**
 * 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 {


  
#pragma mark - NativeIbeaconIbeaconConfig

template <typename P0>
struct NativeIbeaconIbeaconConfig {
  P0 scanDuration;
  bool operator==(const NativeIbeaconIbeaconConfig &other) const {
    return scanDuration == other.scanDuration;
  }
};

template <typename T>
struct NativeIbeaconIbeaconConfigBridging {
  static T types;

  static T fromJs(
      jsi::Runtime &rt,
      const jsi::Object &value,
      const std::shared_ptr<CallInvoker> &jsInvoker) {
    T result{
      bridging::fromJs<decltype(types.scanDuration)>(rt, value.getProperty(rt, "scanDuration"), jsInvoker)};
    return result;
  }

#ifdef DEBUG
  static double scanDurationToJs(jsi::Runtime &rt, decltype(types.scanDuration) value) {
    return bridging::toJs(rt, value);
  }
#endif

  static jsi::Object toJs(
      jsi::Runtime &rt,
      const T &value,
      const std::shared_ptr<CallInvoker> &jsInvoker) {
    auto result = facebook::jsi::Object(rt);
    if (value.scanDuration) {
      result.setProperty(rt, "scanDuration", bridging::toJs(rt, value.scanDuration.value(), jsInvoker));
    }
    return result;
  }
};

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

public:
  virtual jsi::Value multiply(jsi::Runtime &rt, double a, double b) = 0;
  virtual jsi::Value startScan(jsi::Runtime &rt, std::optional<jsi::Object> config) = 0;
  virtual jsi::Value stopScan(jsi::Runtime &rt) = 0;
  virtual jsi::Value checkPermissions(jsi::Runtime &rt) = 0;
  virtual jsi::Value isBleSupported(jsi::Runtime &rt) = 0;

};

template <typename T>
class JSI_EXPORT NativeIbeaconCxxSpec : 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 = "Ibeacon";

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


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

    }

    jsi::Value multiply(jsi::Runtime &rt, double a, double b) override {
      static_assert(
          bridging::getParameterCount(&T::multiply) == 3,
          "Expected multiply(...) to have 3 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
    }
    jsi::Value startScan(jsi::Runtime &rt, std::optional<jsi::Object> config) override {
      static_assert(
          bridging::getParameterCount(&T::startScan) == 2,
          "Expected startScan(...) to have 2 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::startScan, jsInvoker_, instance_, std::move(config));
    }
    jsi::Value stopScan(jsi::Runtime &rt) override {
      static_assert(
          bridging::getParameterCount(&T::stopScan) == 1,
          "Expected stopScan(...) to have 1 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::stopScan, jsInvoker_, instance_);
    }
    jsi::Value checkPermissions(jsi::Runtime &rt) override {
      static_assert(
          bridging::getParameterCount(&T::checkPermissions) == 1,
          "Expected checkPermissions(...) to have 1 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::checkPermissions, jsInvoker_, instance_);
    }
    jsi::Value isBleSupported(jsi::Runtime &rt) override {
      static_assert(
          bridging::getParameterCount(&T::isBleSupported) == 1,
          "Expected isBleSupported(...) to have 1 parameters");

      return bridging::callFromJs<jsi::Value>(
          rt, &T::isBleSupported, jsInvoker_, instance_);
    }

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

  Delegate delegate_;
};

} // namespace facebook::react
