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

#pragma once

#include <fbjni/fbjni.h>
#include "BluetoothCapabilities.hpp"

#include <string>

namespace margelo::nitro::munimbluetooth {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ struct "BluetoothCapabilities" and the the Kotlin data class "BluetoothCapabilities".
   */
  struct JBluetoothCapabilities final: public jni::JavaClass<JBluetoothCapabilities> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/munimbluetooth/BluetoothCapabilities;";

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct BluetoothCapabilities by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    BluetoothCapabilities toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldPlatform = clazz->getField<jni::JString>("platform");
      jni::local_ref<jni::JString> platform = this->getFieldValue(fieldPlatform);
      static const auto fieldSupportsBleCentral = clazz->getField<jboolean>("supportsBleCentral");
      jboolean supportsBleCentral = this->getFieldValue(fieldSupportsBleCentral);
      static const auto fieldSupportsBlePeripheral = clazz->getField<jboolean>("supportsBlePeripheral");
      jboolean supportsBlePeripheral = this->getFieldValue(fieldSupportsBlePeripheral);
      static const auto fieldSupportsDescriptors = clazz->getField<jboolean>("supportsDescriptors");
      jboolean supportsDescriptors = this->getFieldValue(fieldSupportsDescriptors);
      static const auto fieldSupportsIncludedServices = clazz->getField<jboolean>("supportsIncludedServices");
      jboolean supportsIncludedServices = this->getFieldValue(fieldSupportsIncludedServices);
      static const auto fieldSupportsMtu = clazz->getField<jboolean>("supportsMtu");
      jboolean supportsMtu = this->getFieldValue(fieldSupportsMtu);
      static const auto fieldSupportsPhy = clazz->getField<jboolean>("supportsPhy");
      jboolean supportsPhy = this->getFieldValue(fieldSupportsPhy);
      static const auto fieldSupportsBonding = clazz->getField<jboolean>("supportsBonding");
      jboolean supportsBonding = this->getFieldValue(fieldSupportsBonding);
      static const auto fieldSupportsExtendedAdvertising = clazz->getField<jboolean>("supportsExtendedAdvertising");
      jboolean supportsExtendedAdvertising = this->getFieldValue(fieldSupportsExtendedAdvertising);
      static const auto fieldSupportsL2cap = clazz->getField<jboolean>("supportsL2cap");
      jboolean supportsL2cap = this->getFieldValue(fieldSupportsL2cap);
      static const auto fieldSupportsClassicBluetooth = clazz->getField<jboolean>("supportsClassicBluetooth");
      jboolean supportsClassicBluetooth = this->getFieldValue(fieldSupportsClassicBluetooth);
      static const auto fieldSupportsBackgroundBle = clazz->getField<jboolean>("supportsBackgroundBle");
      jboolean supportsBackgroundBle = this->getFieldValue(fieldSupportsBackgroundBle);
      static const auto fieldSupportsMultipeerConnectivity = clazz->getField<jboolean>("supportsMultipeerConnectivity");
      jboolean supportsMultipeerConnectivity = this->getFieldValue(fieldSupportsMultipeerConnectivity);
      return BluetoothCapabilities(
        platform->toStdString(),
        static_cast<bool>(supportsBleCentral),
        static_cast<bool>(supportsBlePeripheral),
        static_cast<bool>(supportsDescriptors),
        static_cast<bool>(supportsIncludedServices),
        static_cast<bool>(supportsMtu),
        static_cast<bool>(supportsPhy),
        static_cast<bool>(supportsBonding),
        static_cast<bool>(supportsExtendedAdvertising),
        static_cast<bool>(supportsL2cap),
        static_cast<bool>(supportsClassicBluetooth),
        static_cast<bool>(supportsBackgroundBle),
        static_cast<bool>(supportsMultipeerConnectivity)
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JBluetoothCapabilities::javaobject> fromCpp(const BluetoothCapabilities& value) {
      using JSignature = JBluetoothCapabilities(jni::alias_ref<jni::JString>, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean, jboolean);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        jni::make_jstring(value.platform),
        value.supportsBleCentral,
        value.supportsBlePeripheral,
        value.supportsDescriptors,
        value.supportsIncludedServices,
        value.supportsMtu,
        value.supportsPhy,
        value.supportsBonding,
        value.supportsExtendedAdvertising,
        value.supportsL2cap,
        value.supportsClassicBluetooth,
        value.supportsBackgroundBle,
        value.supportsMultipeerConnectivity
      );
    }
  };

} // namespace margelo::nitro::munimbluetooth
