///
/// JPhyStatus.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 "PhyStatus.hpp"

#include "BluetoothPhy.hpp"
#include "JBluetoothPhy.hpp"

namespace margelo::nitro::munimbluetooth {

  using namespace facebook;

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

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct PhyStatus by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    PhyStatus toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldTxPhy = clazz->getField<JBluetoothPhy>("txPhy");
      jni::local_ref<JBluetoothPhy> txPhy = this->getFieldValue(fieldTxPhy);
      static const auto fieldRxPhy = clazz->getField<JBluetoothPhy>("rxPhy");
      jni::local_ref<JBluetoothPhy> rxPhy = this->getFieldValue(fieldRxPhy);
      return PhyStatus(
        txPhy->toCpp(),
        rxPhy->toCpp()
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JPhyStatus::javaobject> fromCpp(const PhyStatus& value) {
      using JSignature = JPhyStatus(jni::alias_ref<JBluetoothPhy>, jni::alias_ref<JBluetoothPhy>);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        JBluetoothPhy::fromCpp(value.txPhy),
        JBluetoothPhy::fromCpp(value.rxPhy)
      );
    }
  };

} // namespace margelo::nitro::munimbluetooth
