///
/// NitroRenewalInfoIOS.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 (NitroRenewalInfoIOS).
   */
  struct NitroRenewalInfoIOS final {
  public:
    bool willAutoRenew     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> autoRenewPreference     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> pendingUpgradeProductId     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, double>> renewalDate     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> expirationReason     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, bool>> isInBillingRetry     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, double>> gracePeriodExpirationDate     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> priceIncreaseStatus     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> renewalOfferType     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> renewalOfferId     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> jsonRepresentation     SWIFT_PRIVATE;

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

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

} // namespace margelo::nitro::iap

namespace margelo::nitro {

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

} // namespace margelo::nitro
