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

#pragma once

#if __has_include(<NitroModules/JSIConverter.hpp>)
#include <NitroModules/JSIConverter.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/NitroDefines.hpp>)
#include <NitroModules/NitroDefines.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/JSIHelpers.hpp>)
#include <NitroModules/JSIHelpers.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
#include <NitroModules/PropNameIDCache.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `PendingPurchaseUpdateAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct PendingPurchaseUpdateAndroid; }
// Forward declaration of `IapPlatform` to properly resolve imports.
namespace margelo::nitro::iap { enum class IapPlatform; }
// Forward declaration of `PurchaseState` to properly resolve imports.
namespace margelo::nitro::iap { enum class PurchaseState; }
// Forward declaration of `IapStore` to properly resolve imports.
namespace margelo::nitro::iap { enum class IapStore; }

#include <NitroModules/Null.hpp>
#include <variant>
#include <optional>
#include <string>
#include <vector>
#include "PendingPurchaseUpdateAndroid.hpp"
#include "IapPlatform.hpp"
#include "PurchaseState.hpp"
#include "IapStore.hpp"

namespace margelo::nitro::iap {

  /**
   * A struct which can be represented as a JavaScript object (PurchaseAndroid).
   */
  struct PurchaseAndroid final {
  public:
    std::optional<std::variant<nitro::NullType, bool>> autoRenewingAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> currentPlanId     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> dataAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> developerPayloadAndroid     SWIFT_PRIVATE;
    std::string id     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::vector<std::string>>> ids     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, bool>> isAcknowledgedAndroid     SWIFT_PRIVATE;
    bool isAutoRenewing     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, bool>> isSuspendedAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> obfuscatedAccountIdAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> obfuscatedProfileIdAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> packageNameAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, PendingPurchaseUpdateAndroid>> pendingPurchaseUpdateAndroid     SWIFT_PRIVATE;
    IapPlatform platform     SWIFT_PRIVATE;
    std::string productId     SWIFT_PRIVATE;
    PurchaseState purchaseState     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> purchaseToken     SWIFT_PRIVATE;
    double quantity     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> signatureAndroid     SWIFT_PRIVATE;
    IapStore store     SWIFT_PRIVATE;
    double transactionDate     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> transactionId     SWIFT_PRIVATE;

  public:
    PurchaseAndroid() = default;
    explicit PurchaseAndroid(std::optional<std::variant<nitro::NullType, bool>> autoRenewingAndroid, std::optional<std::variant<nitro::NullType, std::string>> currentPlanId, std::optional<std::variant<nitro::NullType, std::string>> dataAndroid, std::optional<std::variant<nitro::NullType, std::string>> developerPayloadAndroid, std::string id, std::optional<std::variant<nitro::NullType, std::vector<std::string>>> ids, std::optional<std::variant<nitro::NullType, bool>> isAcknowledgedAndroid, bool isAutoRenewing, std::optional<std::variant<nitro::NullType, bool>> isSuspendedAndroid, std::optional<std::variant<nitro::NullType, std::string>> obfuscatedAccountIdAndroid, std::optional<std::variant<nitro::NullType, std::string>> obfuscatedProfileIdAndroid, std::optional<std::variant<nitro::NullType, std::string>> packageNameAndroid, std::optional<std::variant<nitro::NullType, PendingPurchaseUpdateAndroid>> pendingPurchaseUpdateAndroid, IapPlatform platform, std::string productId, PurchaseState purchaseState, std::optional<std::variant<nitro::NullType, std::string>> purchaseToken, double quantity, std::optional<std::variant<nitro::NullType, std::string>> signatureAndroid, IapStore store, double transactionDate, std::optional<std::variant<nitro::NullType, std::string>> transactionId): autoRenewingAndroid(autoRenewingAndroid), currentPlanId(currentPlanId), dataAndroid(dataAndroid), developerPayloadAndroid(developerPayloadAndroid), id(id), ids(ids), isAcknowledgedAndroid(isAcknowledgedAndroid), isAutoRenewing(isAutoRenewing), isSuspendedAndroid(isSuspendedAndroid), obfuscatedAccountIdAndroid(obfuscatedAccountIdAndroid), obfuscatedProfileIdAndroid(obfuscatedProfileIdAndroid), packageNameAndroid(packageNameAndroid), pendingPurchaseUpdateAndroid(pendingPurchaseUpdateAndroid), platform(platform), productId(productId), purchaseState(purchaseState), purchaseToken(purchaseToken), quantity(quantity), signatureAndroid(signatureAndroid), store(store), transactionDate(transactionDate), transactionId(transactionId) {}

  public:
    friend bool operator==(const PurchaseAndroid& lhs, const PurchaseAndroid& rhs) = default;
  };

} // namespace margelo::nitro::iap

namespace margelo::nitro {

  // C++ PurchaseAndroid <> JS PurchaseAndroid (object)
  template <>
  struct JSIConverter<margelo::nitro::iap::PurchaseAndroid> final {
    static inline margelo::nitro::iap::PurchaseAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::iap::PurchaseAndroid(
        JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewingAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currentPlanId"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dataAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "developerPayloadAndroid"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::vector<std::string>>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ids"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isAcknowledgedAndroid"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isAutoRenewing"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isSuspendedAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedAccountIdAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedProfileIdAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "packageNameAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::PendingPurchaseUpdateAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pendingPurchaseUpdateAndroid"))),
        JSIConverter<margelo::nitro::iap::IapPlatform>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "platform"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "productId"))),
        JSIConverter<margelo::nitro::iap::PurchaseState>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "purchaseState"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "purchaseToken"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quantity"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signatureAndroid"))),
        JSIConverter<margelo::nitro::iap::IapStore>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "store"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactionDate"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactionId")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::PurchaseAndroid& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoRenewingAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.autoRenewingAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "currentPlanId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.currentPlanId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "dataAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.dataAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "developerPayloadAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.developerPayloadAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "ids"), JSIConverter<std::optional<std::variant<nitro::NullType, std::vector<std::string>>>>::toJSI(runtime, arg.ids));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isAcknowledgedAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.isAcknowledgedAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isAutoRenewing"), JSIConverter<bool>::toJSI(runtime, arg.isAutoRenewing));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isSuspendedAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.isSuspendedAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedAccountIdAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.obfuscatedAccountIdAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedProfileIdAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.obfuscatedProfileIdAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "packageNameAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.packageNameAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "pendingPurchaseUpdateAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::PendingPurchaseUpdateAndroid>>>::toJSI(runtime, arg.pendingPurchaseUpdateAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "platform"), JSIConverter<margelo::nitro::iap::IapPlatform>::toJSI(runtime, arg.platform));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "productId"), JSIConverter<std::string>::toJSI(runtime, arg.productId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "purchaseState"), JSIConverter<margelo::nitro::iap::PurchaseState>::toJSI(runtime, arg.purchaseState));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "purchaseToken"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.purchaseToken));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "quantity"), JSIConverter<double>::toJSI(runtime, arg.quantity));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "signatureAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.signatureAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "store"), JSIConverter<margelo::nitro::iap::IapStore>::toJSI(runtime, arg.store));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "transactionDate"), JSIConverter<double>::toJSI(runtime, arg.transactionDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "transactionId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.transactionId));
      return obj;
    }
    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
      if (!value.isObject()) {
        return false;
      }
      jsi::Object obj = value.getObject(runtime);
      if (!nitro::isPlainObject(runtime, obj)) {
        return false;
      }
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewingAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currentPlanId")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dataAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "developerPayloadAndroid")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::vector<std::string>>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ids")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isAcknowledgedAndroid")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isAutoRenewing")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isSuspendedAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedAccountIdAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "obfuscatedProfileIdAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "packageNameAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::PendingPurchaseUpdateAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pendingPurchaseUpdateAndroid")))) return false;
      if (!JSIConverter<margelo::nitro::iap::IapPlatform>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "platform")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "productId")))) return false;
      if (!JSIConverter<margelo::nitro::iap::PurchaseState>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "purchaseState")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "purchaseToken")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "quantity")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "signatureAndroid")))) return false;
      if (!JSIConverter<margelo::nitro::iap::IapStore>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "store")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactionDate")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactionId")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
