///
/// NitroOneTimePurchaseOfferDetail.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 `NitroDiscountDisplayInfoAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct NitroDiscountDisplayInfoAndroid; }
// Forward declaration of `NitroLimitedQuantityInfoAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct NitroLimitedQuantityInfoAndroid; }
// Forward declaration of `NitroPreorderDetailsAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct NitroPreorderDetailsAndroid; }
// Forward declaration of `NitroRentalDetailsAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct NitroRentalDetailsAndroid; }
// Forward declaration of `NitroValidTimeWindowAndroid` to properly resolve imports.
namespace margelo::nitro::iap { struct NitroValidTimeWindowAndroid; }

#include <NitroModules/Null.hpp>
#include "NitroDiscountDisplayInfoAndroid.hpp"
#include <variant>
#include <optional>
#include <string>
#include "NitroLimitedQuantityInfoAndroid.hpp"
#include <vector>
#include "NitroPreorderDetailsAndroid.hpp"
#include "NitroRentalDetailsAndroid.hpp"
#include "NitroValidTimeWindowAndroid.hpp"

namespace margelo::nitro::iap {

  /**
   * A struct which can be represented as a JavaScript object (NitroOneTimePurchaseOfferDetail).
   */
  struct NitroOneTimePurchaseOfferDetail final {
  public:
    std::optional<std::variant<nitro::NullType, NitroDiscountDisplayInfoAndroid>> discountDisplayInfo     SWIFT_PRIVATE;
    std::string formattedPrice     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> fullPriceMicros     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, NitroLimitedQuantityInfoAndroid>> limitedQuantityInfo     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> offerId     SWIFT_PRIVATE;
    std::vector<std::string> offerTags     SWIFT_PRIVATE;
    std::string offerToken     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, NitroPreorderDetailsAndroid>> preorderDetailsAndroid     SWIFT_PRIVATE;
    std::string priceAmountMicros     SWIFT_PRIVATE;
    std::string priceCurrencyCode     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, NitroRentalDetailsAndroid>> rentalDetailsAndroid     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, NitroValidTimeWindowAndroid>> validTimeWindow     SWIFT_PRIVATE;

  public:
    NitroOneTimePurchaseOfferDetail() = default;
    explicit NitroOneTimePurchaseOfferDetail(std::optional<std::variant<nitro::NullType, NitroDiscountDisplayInfoAndroid>> discountDisplayInfo, std::string formattedPrice, std::optional<std::variant<nitro::NullType, std::string>> fullPriceMicros, std::optional<std::variant<nitro::NullType, NitroLimitedQuantityInfoAndroid>> limitedQuantityInfo, std::optional<std::variant<nitro::NullType, std::string>> offerId, std::vector<std::string> offerTags, std::string offerToken, std::optional<std::variant<nitro::NullType, NitroPreorderDetailsAndroid>> preorderDetailsAndroid, std::string priceAmountMicros, std::string priceCurrencyCode, std::optional<std::variant<nitro::NullType, NitroRentalDetailsAndroid>> rentalDetailsAndroid, std::optional<std::variant<nitro::NullType, NitroValidTimeWindowAndroid>> validTimeWindow): discountDisplayInfo(discountDisplayInfo), formattedPrice(formattedPrice), fullPriceMicros(fullPriceMicros), limitedQuantityInfo(limitedQuantityInfo), offerId(offerId), offerTags(offerTags), offerToken(offerToken), preorderDetailsAndroid(preorderDetailsAndroid), priceAmountMicros(priceAmountMicros), priceCurrencyCode(priceCurrencyCode), rentalDetailsAndroid(rentalDetailsAndroid), validTimeWindow(validTimeWindow) {}

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

} // namespace margelo::nitro::iap

namespace margelo::nitro {

  // C++ NitroOneTimePurchaseOfferDetail <> JS NitroOneTimePurchaseOfferDetail (object)
  template <>
  struct JSIConverter<margelo::nitro::iap::NitroOneTimePurchaseOfferDetail> final {
    static inline margelo::nitro::iap::NitroOneTimePurchaseOfferDetail fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::iap::NitroOneTimePurchaseOfferDetail(
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "discountDisplayInfo"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formattedPrice"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fullPriceMicros"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limitedQuantityInfo"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerId"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerTags"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerToken"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroPreorderDetailsAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preorderDetailsAndroid"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceAmountMicros"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceCurrencyCode"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRentalDetailsAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rentalDetailsAndroid"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroValidTimeWindowAndroid>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validTimeWindow")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroOneTimePurchaseOfferDetail& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "discountDisplayInfo"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>>::toJSI(runtime, arg.discountDisplayInfo));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "formattedPrice"), JSIConverter<std::string>::toJSI(runtime, arg.formattedPrice));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fullPriceMicros"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.fullPriceMicros));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "limitedQuantityInfo"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>>::toJSI(runtime, arg.limitedQuantityInfo));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "offerId"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.offerId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "offerTags"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.offerTags));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "offerToken"), JSIConverter<std::string>::toJSI(runtime, arg.offerToken));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "preorderDetailsAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroPreorderDetailsAndroid>>>::toJSI(runtime, arg.preorderDetailsAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "priceAmountMicros"), JSIConverter<std::string>::toJSI(runtime, arg.priceAmountMicros));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "priceCurrencyCode"), JSIConverter<std::string>::toJSI(runtime, arg.priceCurrencyCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "rentalDetailsAndroid"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRentalDetailsAndroid>>>::toJSI(runtime, arg.rentalDetailsAndroid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "validTimeWindow"), JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroValidTimeWindowAndroid>>>::toJSI(runtime, arg.validTimeWindow));
      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, margelo::nitro::iap::NitroDiscountDisplayInfoAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "discountDisplayInfo")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "formattedPrice")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fullPriceMicros")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroLimitedQuantityInfoAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "limitedQuantityInfo")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerId")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerTags")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offerToken")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroPreorderDetailsAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preorderDetailsAndroid")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceAmountMicros")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "priceCurrencyCode")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroRentalDetailsAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rentalDetailsAndroid")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, margelo::nitro::iap::NitroValidTimeWindowAndroid>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validTimeWindow")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
