///
/// JColorScheme.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 "ColorScheme.hpp"

namespace margelo::nitro::unistyles {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::unistyles
