///
/// JAppleAuthScope.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 "AppleAuthScope.hpp"

namespace margelo::nitro::one {

  using namespace facebook;

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

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

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

} // namespace margelo::nitro::one
