///
/// JFlipAxis.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 "FlipAxis.hpp"

namespace margelo::nitro::videopipeline {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::videopipeline
