///
/// JFontWeight.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 "FontWeight.hpp"

namespace margelo::nitro::videopipeline {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::videopipeline
