///
/// JVariant_Boolean_NitroPurchaseResult.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 <variant>

#include "NitroPurchaseResult.hpp"
#include <variant>
#include "JNitroPurchaseResult.hpp"
#include <string>
#include <optional>

namespace margelo::nitro::iap {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_Boolean_NitroPurchaseResult".
   */
  class JVariant_Boolean_NitroPurchaseResult: public jni::JavaClass<JVariant_Boolean_NitroPurchaseResult> {
  public:
    static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult;";

    static jni::local_ref<JVariant_Boolean_NitroPurchaseResult> create_0(jboolean value) {
      static const auto method = javaClassStatic()->getStaticMethod<JVariant_Boolean_NitroPurchaseResult(jboolean)>("create");
      return method(javaClassStatic(), value);
    }
    static jni::local_ref<JVariant_Boolean_NitroPurchaseResult> create_1(jni::alias_ref<JNitroPurchaseResult> value) {
      static const auto method = javaClassStatic()->getStaticMethod<JVariant_Boolean_NitroPurchaseResult(jni::alias_ref<JNitroPurchaseResult>)>("create");
      return method(javaClassStatic(), value);
    }

    static jni::local_ref<JVariant_Boolean_NitroPurchaseResult> fromCpp(const std::variant<bool, NitroPurchaseResult>& variant) {
      switch (variant.index()) {
        case 0: return create_0(std::get<0>(variant));
        case 1: return create_1(JNitroPurchaseResult::fromCpp(std::get<1>(variant)));
        default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
      }
    }

    [[nodiscard]] std::variant<bool, NitroPurchaseResult> toCpp() const;
  };

  namespace JVariant_Boolean_NitroPurchaseResult_impl {
    class First final: public jni::JavaClass<First, JVariant_Boolean_NitroPurchaseResult> {
    public:
      static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult$First;";
    
      [[nodiscard]] jboolean getValue() const {
        static const auto field = javaClassStatic()->getField<jboolean>("value");
        return getFieldValue(field);
      }
    };
    
    class Second final: public jni::JavaClass<Second, JVariant_Boolean_NitroPurchaseResult> {
    public:
      static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_Boolean_NitroPurchaseResult$Second;";
    
      [[nodiscard]] jni::local_ref<JNitroPurchaseResult> getValue() const {
        static const auto field = javaClassStatic()->getField<JNitroPurchaseResult>("value");
        return getFieldValue(field);
      }
    };
  } // namespace JVariant_Boolean_NitroPurchaseResult_impl
} // namespace margelo::nitro::iap
