///
/// RenewalInfoIOS.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



#include <NitroModules/Null.hpp>
#include <string>
#include <variant>
#include <optional>

namespace margelo::nitro::iap {

  /**
   * A struct which can be represented as a JavaScript object (RenewalInfoIOS).
   */
  struct RenewalInfoIOS final {
  public:
    std::optional<std::variant<nitro::NullType, std::string>> autoRenewPreference     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> expirationReason     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, double>> gracePeriodExpirationDate     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, bool>> isInBillingRetry     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> jsonRepresentation     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> pendingUpgradeProductId     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> priceIncreaseStatus     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, double>> renewalDate     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> renewalOfferId     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> renewalOfferType     SWIFT_PRIVATE;
    bool willAutoRenew     SWIFT_PRIVATE;

  public:
    RenewalInfoIOS() = default;
    explicit RenewalInfoIOS(std::optional<std::variant<nitro::NullType, std::string>> autoRenewPreference, std::optional<std::variant<nitro::NullType, std::string>> expirationReason, std::optional<std::variant<nitro::NullType, double>> gracePeriodExpirationDate, std::optional<std::variant<nitro::NullType, bool>> isInBillingRetry, std::optional<std::variant<nitro::NullType, std::string>> jsonRepresentation, std::optional<std::variant<nitro::NullType, std::string>> pendingUpgradeProductId, std::optional<std::variant<nitro::NullType, std::string>> priceIncreaseStatus, std::optional<std::variant<nitro::NullType, double>> renewalDate, std::optional<std::variant<nitro::NullType, std::string>> renewalOfferId, std::optional<std::variant<nitro::NullType, std::string>> renewalOfferType, bool willAutoRenew): autoRenewPreference(autoRenewPreference), expirationReason(expirationReason), gracePeriodExpirationDate(gracePeriodExpirationDate), isInBillingRetry(isInBillingRetry), jsonRepresentation(jsonRepresentation), pendingUpgradeProductId(pendingUpgradeProductId), priceIncreaseStatus(priceIncreaseStatus), renewalDate(renewalDate), renewalOfferId(renewalOfferId), renewalOfferType(renewalOfferType), willAutoRenew(willAutoRenew) {}

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

} // namespace margelo::nitro::iap

namespace margelo::nitro {

  // C++ RenewalInfoIOS <> JS RenewalInfoIOS (object)
  template <>
  struct JSIConverter<margelo::nitro::iap::RenewalInfoIOS> final {
    static inline margelo::nitro::iap::RenewalInfoIOS fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::iap::RenewalInfoIOS(
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewPreference"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expirationReason"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gracePeriodExpirationDate"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isInBillingRetry"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "jsonRepresentation"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pendingUpgradeProductId"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceIncreaseStatus"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalDate"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferId"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferType"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "willAutoRenew")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::RenewalInfoIOS& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoRenewPreference"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.autoRenewPreference));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "expirationReason"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.expirationReason));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "gracePeriodExpirationDate"), JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::toJSI(runtime, arg.gracePeriodExpirationDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isInBillingRetry"), JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::toJSI(runtime, arg.isInBillingRetry));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "jsonRepresentation"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.jsonRepresentation));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "pendingUpgradeProductId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.pendingUpgradeProductId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "priceIncreaseStatus"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.priceIncreaseStatus));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "renewalDate"), JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::toJSI(runtime, arg.renewalDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.renewalOfferId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferType"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.renewalOfferType));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "willAutoRenew"), JSIConverter<bool>::toJSI(runtime, arg.willAutoRenew));
      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, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRenewPreference")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expirationReason")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gracePeriodExpirationDate")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, bool>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isInBillingRetry")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "jsonRepresentation")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pendingUpgradeProductId")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceIncreaseStatus")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalDate")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferId")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "renewalOfferType")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "willAutoRenew")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
