///
/// JExternalLinkLaunchModeAndroid.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 "ExternalLinkLaunchModeAndroid.hpp"

namespace margelo::nitro::iap {

  using namespace facebook;

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

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

  public:
    /**
     * Create a Java/Kotlin-based enum with the given C++ enum's value.
     */
    [[maybe_unused]]
    static jni::alias_ref<JExternalLinkLaunchModeAndroid> fromCpp(ExternalLinkLaunchModeAndroid value) {
      static const auto clazz = javaClassStatic();
      switch (value) {
        case ExternalLinkLaunchModeAndroid::UNSPECIFIED:
          static const auto fieldUNSPECIFIED = clazz->getStaticField<JExternalLinkLaunchModeAndroid>("UNSPECIFIED");
          return clazz->getStaticFieldValue(fieldUNSPECIFIED);
        case ExternalLinkLaunchModeAndroid::LAUNCH_IN_EXTERNAL_BROWSER_OR_APP:
          static const auto fieldLAUNCH_IN_EXTERNAL_BROWSER_OR_APP = clazz->getStaticField<JExternalLinkLaunchModeAndroid>("LAUNCH_IN_EXTERNAL_BROWSER_OR_APP");
          return clazz->getStaticFieldValue(fieldLAUNCH_IN_EXTERNAL_BROWSER_OR_APP);
        case ExternalLinkLaunchModeAndroid::CALLER_WILL_LAUNCH_LINK:
          static const auto fieldCALLER_WILL_LAUNCH_LINK = clazz->getStaticField<JExternalLinkLaunchModeAndroid>("CALLER_WILL_LAUNCH_LINK");
          return clazz->getStaticFieldValue(fieldCALLER_WILL_LAUNCH_LINK);
        default:
          std::string stringValue = std::to_string(static_cast<int>(value));
          throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
      }
    }
  };

} // namespace margelo::nitro::iap
