///
/// NativeLiveActivityState.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 <unordered_map>

namespace margelo::nitro::liveactivitykit {

  /**
   * A struct which can be represented as a JavaScript object (NativeLiveActivityState).
   */
  struct NativeLiveActivityState final {
  public:
    std::string title     SWIFT_PRIVATE;
    std::optional<std::string> subtitle     SWIFT_PRIVATE;
    std::optional<std::string> body     SWIFT_PRIVATE;
    std::optional<std::string> status     SWIFT_PRIVATE;
    std::optional<double> progress     SWIFT_PRIVATE;
    std::optional<double> date     SWIFT_PRIVATE;
    std::optional<std::string> imageName     SWIFT_PRIVATE;
    std::optional<std::string> tintColorHex     SWIFT_PRIVATE;
    std::optional<std::string> leading     SWIFT_PRIVATE;
    std::optional<std::string> trailing     SWIFT_PRIVATE;
    std::unordered_map<std::string, std::string> extra     SWIFT_PRIVATE;

  public:
    NativeLiveActivityState() = default;
    explicit NativeLiveActivityState(std::string title, std::optional<std::string> subtitle, std::optional<std::string> body, std::optional<std::string> status, std::optional<double> progress, std::optional<double> date, std::optional<std::string> imageName, std::optional<std::string> tintColorHex, std::optional<std::string> leading, std::optional<std::string> trailing, std::unordered_map<std::string, std::string> extra): title(title), subtitle(subtitle), body(body), status(status), progress(progress), date(date), imageName(imageName), tintColorHex(tintColorHex), leading(leading), trailing(trailing), extra(extra) {}

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

} // namespace margelo::nitro::liveactivitykit

namespace margelo::nitro {

  // C++ NativeLiveActivityState <> JS NativeLiveActivityState (object)
  template <>
  struct JSIConverter<margelo::nitro::liveactivitykit::NativeLiveActivityState> final {
    static inline margelo::nitro::liveactivitykit::NativeLiveActivityState fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::liveactivitykit::NativeLiveActivityState(
        JSIConverter<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::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "progress"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageName"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tintColorHex"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "leading"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailing"))),
        JSIConverter<std::unordered_map<std::string, std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "extra")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::liveactivitykit::NativeLiveActivityState& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter<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, "status"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.status));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "progress"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.progress));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "date"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.date));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.imageName));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "tintColorHex"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.tintColorHex));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "leading"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.leading));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "trailing"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.trailing));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "extra"), JSIConverter<std::unordered_map<std::string, std::string>>::toJSI(runtime, arg.extra));
      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::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::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "progress")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageName")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tintColorHex")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "leading")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trailing")))) return false;
      if (!JSIConverter<std::unordered_map<std::string, std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "extra")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
