///
/// JHapticNotification.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 "HapticNotification.hpp"

namespace margelo::nitro::one {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ enum "HapticNotification" and the Kotlin enum "HapticNotification".
   */
  struct JHapticNotification final: public jni::JavaClass<JHapticNotification> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/one/HapticNotification;";

  public:
    /**
     * Convert this Java/Kotlin-based enum to the C++ enum HapticNotification.
     */
    [[maybe_unused]]
    [[nodiscard]]
    HapticNotification toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldOrdinal = clazz->getField<int>("value");
      int ordinal = this->getFieldValue(fieldOrdinal);
      return static_cast<HapticNotification>(ordinal);
    }

  public:
    /**
     * Create a Java/Kotlin-based enum with the given C++ enum's value.
     */
    [[maybe_unused]]
    static jni::alias_ref<JHapticNotification> fromCpp(HapticNotification value) {
      static const auto clazz = javaClassStatic();
      switch (value) {
        case HapticNotification::SUCCESS:
          static const auto fieldSUCCESS = clazz->getStaticField<JHapticNotification>("SUCCESS");
          return clazz->getStaticFieldValue(fieldSUCCESS);
        case HapticNotification::WARNING:
          static const auto fieldWARNING = clazz->getStaticField<JHapticNotification>("WARNING");
          return clazz->getStaticFieldValue(fieldWARNING);
        case HapticNotification::ERROR:
          static const auto fieldERROR = clazz->getStaticField<JHapticNotification>("ERROR");
          return clazz->getStaticFieldValue(fieldERROR);
        default:
          std::string stringValue = std::to_string(static_cast<int>(value));
          throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
      }
    }
  };

} // namespace margelo::nitro::one
