///
/// JIgnoreSilentSwitchMode.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "IgnoreSilentSwitchMode.hpp"

namespace margelo::nitro::video {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::video
