///
/// JMixAudioMode.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 "MixAudioMode.hpp"

namespace margelo::nitro::video {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::video
