///
/// NativeContentInput.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 <string>
#include <optional>
#include <NitroModules/AnyMap.hpp>

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (NativeContentInput).
   */
  struct NativeContentInput final {
  public:
    std::optional<std::string> title     SWIFT_PRIVATE;
    std::optional<std::string> subtitle     SWIFT_PRIVATE;
    std::optional<std::string> body     SWIFT_PRIVATE;
    std::optional<std::shared_ptr<AnyMap>> data     SWIFT_PRIVATE;
    std::optional<bool> sound     SWIFT_PRIVATE;
    std::optional<double> badge     SWIFT_PRIVATE;
    std::optional<std::string> categoryIdentifier     SWIFT_PRIVATE;

  public:
    NativeContentInput() = default;
    explicit NativeContentInput(std::optional<std::string> title, std::optional<std::string> subtitle, std::optional<std::string> body, std::optional<std::shared_ptr<AnyMap>> data, std::optional<bool> sound, std::optional<double> badge, std::optional<std::string> categoryIdentifier): title(title), subtitle(subtitle), body(body), data(data), sound(sound), badge(badge), categoryIdentifier(categoryIdentifier) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ NativeContentInput <> JS NativeContentInput (object)
  template <>
  struct JSIConverter<margelo::nitro::one::NativeContentInput> final {
    static inline margelo::nitro::one::NativeContentInput fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::NativeContentInput(
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body"))),
        JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sound"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "badge"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "categoryIdentifier")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::NativeContentInput& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.title));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subtitle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "body"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.body));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "data"), JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.data));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sound"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.sound));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "badge"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.badge));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "categoryIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.categoryIdentifier));
      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, "title")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "body")))) return false;
      if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sound")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "badge")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "categoryIdentifier")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
