///
/// BluetoothCapabilities.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



#include <string>

namespace margelo::nitro::munimbluetooth {

  /**
   * A struct which can be represented as a JavaScript object (BluetoothCapabilities).
   */
  struct BluetoothCapabilities final {
  public:
    std::string platform     SWIFT_PRIVATE;
    bool supportsBleCentral     SWIFT_PRIVATE;
    bool supportsBlePeripheral     SWIFT_PRIVATE;
    bool supportsDescriptors     SWIFT_PRIVATE;
    bool supportsIncludedServices     SWIFT_PRIVATE;
    bool supportsMtu     SWIFT_PRIVATE;
    bool supportsPhy     SWIFT_PRIVATE;
    bool supportsBonding     SWIFT_PRIVATE;
    bool supportsExtendedAdvertising     SWIFT_PRIVATE;
    bool supportsL2cap     SWIFT_PRIVATE;
    bool supportsClassicBluetooth     SWIFT_PRIVATE;
    bool supportsBackgroundBle     SWIFT_PRIVATE;
    bool supportsMultipeerConnectivity     SWIFT_PRIVATE;

  public:
    BluetoothCapabilities() = default;
    explicit BluetoothCapabilities(std::string platform, bool supportsBleCentral, bool supportsBlePeripheral, bool supportsDescriptors, bool supportsIncludedServices, bool supportsMtu, bool supportsPhy, bool supportsBonding, bool supportsExtendedAdvertising, bool supportsL2cap, bool supportsClassicBluetooth, bool supportsBackgroundBle, bool supportsMultipeerConnectivity): platform(platform), supportsBleCentral(supportsBleCentral), supportsBlePeripheral(supportsBlePeripheral), supportsDescriptors(supportsDescriptors), supportsIncludedServices(supportsIncludedServices), supportsMtu(supportsMtu), supportsPhy(supportsPhy), supportsBonding(supportsBonding), supportsExtendedAdvertising(supportsExtendedAdvertising), supportsL2cap(supportsL2cap), supportsClassicBluetooth(supportsClassicBluetooth), supportsBackgroundBle(supportsBackgroundBle), supportsMultipeerConnectivity(supportsMultipeerConnectivity) {}

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

} // namespace margelo::nitro::munimbluetooth

namespace margelo::nitro {

  // C++ BluetoothCapabilities <> JS BluetoothCapabilities (object)
  template <>
  struct JSIConverter<margelo::nitro::munimbluetooth::BluetoothCapabilities> final {
    static inline margelo::nitro::munimbluetooth::BluetoothCapabilities fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::munimbluetooth::BluetoothCapabilities(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "platform"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBleCentral"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBlePeripheral"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsDescriptors"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsIncludedServices"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsMtu"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsPhy"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBonding"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsExtendedAdvertising"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsL2cap"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsClassicBluetooth"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBackgroundBle"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsMultipeerConnectivity")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::munimbluetooth::BluetoothCapabilities& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "platform"), JSIConverter<std::string>::toJSI(runtime, arg.platform));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsBleCentral"), JSIConverter<bool>::toJSI(runtime, arg.supportsBleCentral));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsBlePeripheral"), JSIConverter<bool>::toJSI(runtime, arg.supportsBlePeripheral));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsDescriptors"), JSIConverter<bool>::toJSI(runtime, arg.supportsDescriptors));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsIncludedServices"), JSIConverter<bool>::toJSI(runtime, arg.supportsIncludedServices));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsMtu"), JSIConverter<bool>::toJSI(runtime, arg.supportsMtu));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsPhy"), JSIConverter<bool>::toJSI(runtime, arg.supportsPhy));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsBonding"), JSIConverter<bool>::toJSI(runtime, arg.supportsBonding));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsExtendedAdvertising"), JSIConverter<bool>::toJSI(runtime, arg.supportsExtendedAdvertising));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsL2cap"), JSIConverter<bool>::toJSI(runtime, arg.supportsL2cap));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsClassicBluetooth"), JSIConverter<bool>::toJSI(runtime, arg.supportsClassicBluetooth));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsBackgroundBle"), JSIConverter<bool>::toJSI(runtime, arg.supportsBackgroundBle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "supportsMultipeerConnectivity"), JSIConverter<bool>::toJSI(runtime, arg.supportsMultipeerConnectivity));
      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::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "platform")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBleCentral")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBlePeripheral")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsDescriptors")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsIncludedServices")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsMtu")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsPhy")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBonding")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsExtendedAdvertising")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsL2cap")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsClassicBluetooth")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsBackgroundBle")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "supportsMultipeerConnectivity")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
