///
/// TikTokContentEventProperties.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 `TikTokContent` to properly resolve imports.
namespace margelo::nitro::tiktokappevents { struct TikTokContent; }

#include <string>
#include <optional>
#include "TikTokContent.hpp"
#include <vector>

namespace margelo::nitro::tiktokappevents {

  /**
   * A struct which can be represented as a JavaScript object (TikTokContentEventProperties).
   */
  struct TikTokContentEventProperties final {
  public:
    std::optional<std::string> contentType     SWIFT_PRIVATE;
    std::optional<std::string> contentId     SWIFT_PRIVATE;
    std::optional<std::string> description     SWIFT_PRIVATE;
    std::optional<std::string> currency     SWIFT_PRIVATE;
    std::optional<double> value     SWIFT_PRIVATE;
    std::optional<std::string> orderId     SWIFT_PRIVATE;
    std::optional<std::vector<TikTokContent>> contents     SWIFT_PRIVATE;

  public:
    TikTokContentEventProperties() = default;
    explicit TikTokContentEventProperties(std::optional<std::string> contentType, std::optional<std::string> contentId, std::optional<std::string> description, std::optional<std::string> currency, std::optional<double> value, std::optional<std::string> orderId, std::optional<std::vector<TikTokContent>> contents): contentType(contentType), contentId(contentId), description(description), currency(currency), value(value), orderId(orderId), contents(contents) {}

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

} // namespace margelo::nitro::tiktokappevents

namespace margelo::nitro {

  // C++ TikTokContentEventProperties <> JS TikTokContentEventProperties (object)
  template <>
  struct JSIConverter<margelo::nitro::tiktokappevents::TikTokContentEventProperties> final {
    static inline margelo::nitro::tiktokappevents::TikTokContentEventProperties fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::tiktokappevents::TikTokContentEventProperties(
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentType"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentId"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orderId"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::tiktokappevents::TikTokContent>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contents")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::tiktokappevents::TikTokContentEventProperties& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "contentType"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.contentType));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "contentId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.contentId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.description));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "currency"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currency));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "value"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.value));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "orderId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.orderId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "contents"), JSIConverter<std::optional<std::vector<margelo::nitro::tiktokappevents::TikTokContent>>>::toJSI(runtime, arg.contents));
      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::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentType")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contentId")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currency")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "value")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "orderId")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::tiktokappevents::TikTokContent>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contents")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
