///
/// JUserInterfaceStyle.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 "UserInterfaceStyle.hpp"

namespace margelo::nitro::inappbrowsernitro {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::inappbrowsernitro
