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

#pragma once

#if __has_include(<NitroModules/JSIConverter.hpp>)
#include <NitroModules/JSIConverter.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/NitroDefines.hpp>)
#include <NitroModules/NitroDefines.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/JSIHelpers.hpp>)
#include <NitroModules/JSIHelpers.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
#include <NitroModules/PropNameIDCache.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `AdvertisingDataTypes` to properly resolve imports.
namespace margelo::nitro::munimbluetooth { struct AdvertisingDataTypes; }
// Forward declaration of `BluetoothPhy` to properly resolve imports.
namespace margelo::nitro::munimbluetooth { enum class BluetoothPhy; }

#include <string>
#include <vector>
#include <optional>
#include "AdvertisingDataTypes.hpp"
#include "BluetoothPhy.hpp"

namespace margelo::nitro::munimbluetooth {

  /**
   * A struct which can be represented as a JavaScript object (ExtendedAdvertisingOptions).
   */
  struct ExtendedAdvertisingOptions final {
  public:
    std::optional<std::vector<std::string>> serviceUUIDs     SWIFT_PRIVATE;
    std::optional<std::string> localName     SWIFT_PRIVATE;
    std::optional<std::string> manufacturerData     SWIFT_PRIVATE;
    std::optional<AdvertisingDataTypes> advertisingData     SWIFT_PRIVATE;
    std::optional<bool> connectable     SWIFT_PRIVATE;
    std::optional<bool> scannable     SWIFT_PRIVATE;
    std::optional<bool> legacyMode     SWIFT_PRIVATE;
    std::optional<bool> anonymous     SWIFT_PRIVATE;
    std::optional<bool> includeTxPower     SWIFT_PRIVATE;
    std::optional<double> interval     SWIFT_PRIVATE;
    std::optional<double> txPowerLevel     SWIFT_PRIVATE;
    std::optional<BluetoothPhy> primaryPhy     SWIFT_PRIVATE;
    std::optional<BluetoothPhy> secondaryPhy     SWIFT_PRIVATE;

  public:
    ExtendedAdvertisingOptions() = default;
    explicit ExtendedAdvertisingOptions(std::optional<std::vector<std::string>> serviceUUIDs, std::optional<std::string> localName, std::optional<std::string> manufacturerData, std::optional<AdvertisingDataTypes> advertisingData, std::optional<bool> connectable, std::optional<bool> scannable, std::optional<bool> legacyMode, std::optional<bool> anonymous, std::optional<bool> includeTxPower, std::optional<double> interval, std::optional<double> txPowerLevel, std::optional<BluetoothPhy> primaryPhy, std::optional<BluetoothPhy> secondaryPhy): serviceUUIDs(serviceUUIDs), localName(localName), manufacturerData(manufacturerData), advertisingData(advertisingData), connectable(connectable), scannable(scannable), legacyMode(legacyMode), anonymous(anonymous), includeTxPower(includeTxPower), interval(interval), txPowerLevel(txPowerLevel), primaryPhy(primaryPhy), secondaryPhy(secondaryPhy) {}

  public:
    friend bool operator==(const ExtendedAdvertisingOptions& lhs, const ExtendedAdvertisingOptions& rhs) = default;
  };

} // namespace margelo::nitro::munimbluetooth

namespace margelo::nitro {

  // C++ ExtendedAdvertisingOptions <> JS ExtendedAdvertisingOptions (object)
  template <>
  struct JSIConverter<margelo::nitro::munimbluetooth::ExtendedAdvertisingOptions> final {
    static inline margelo::nitro::munimbluetooth::ExtendedAdvertisingOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::munimbluetooth::ExtendedAdvertisingOptions(
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "localName"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData"))),
        JSIConverter<std::optional<margelo::nitro::munimbluetooth::AdvertisingDataTypes>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "advertisingData"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "connectable"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scannable"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "legacyMode"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "anonymous"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeTxPower"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txPowerLevel"))),
        JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "primaryPhy"))),
        JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "secondaryPhy")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::munimbluetooth::ExtendedAdvertisingOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.serviceUUIDs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "localName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.localName));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.manufacturerData));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "advertisingData"), JSIConverter<std::optional<margelo::nitro::munimbluetooth::AdvertisingDataTypes>>::toJSI(runtime, arg.advertisingData));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "connectable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.connectable));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "scannable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.scannable));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "legacyMode"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.legacyMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "anonymous"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.anonymous));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeTxPower"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeTxPower));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "interval"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.interval));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "txPowerLevel"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.txPowerLevel));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "primaryPhy"), JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::toJSI(runtime, arg.primaryPhy));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "secondaryPhy"), JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::toJSI(runtime, arg.secondaryPhy));
      return obj;
    }
    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
      if (!value.isObject()) {
        return false;
      }
      jsi::Object obj = value.getObject(runtime);
      if (!nitro::isPlainObject(runtime, obj)) {
        return false;
      }
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "serviceUUIDs")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "localName")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "manufacturerData")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::munimbluetooth::AdvertisingDataTypes>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "advertisingData")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "connectable")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "scannable")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "legacyMode")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "anonymous")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeTxPower")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "interval")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txPowerLevel")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "primaryPhy")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::munimbluetooth::BluetoothPhy>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "secondaryPhy")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
