///
/// PAM_ToastParams.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 `PAM_NativeAssetSource` to properly resolve imports.
namespace margelo::nitro::progressandmodal { struct PAM_NativeAssetSource; }

#include <string>
#include <optional>
#include "PAM_NativeAssetSource.hpp"

namespace margelo::nitro::progressandmodal {

  /**
   * A struct which can be represented as a JavaScript object (PAM_ToastParams).
   */
  struct PAM_ToastParams final {
  public:
    std::string message     SWIFT_PRIVATE;
    std::string backgroundColor     SWIFT_PRIVATE;
    std::string textColor     SWIFT_PRIVATE;
    std::optional<double> fontSize     SWIFT_PRIVATE;
    std::optional<PAM_NativeAssetSource> image     SWIFT_PRIVATE;
    std::optional<double> imageSize     SWIFT_PRIVATE;
    std::optional<double> duration     SWIFT_PRIVATE;

  public:
    PAM_ToastParams() = default;
    explicit PAM_ToastParams(std::string message, std::string backgroundColor, std::string textColor, std::optional<double> fontSize, std::optional<PAM_NativeAssetSource> image, std::optional<double> imageSize, std::optional<double> duration): message(message), backgroundColor(backgroundColor), textColor(textColor), fontSize(fontSize), image(image), imageSize(imageSize), duration(duration) {}

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

} // namespace margelo::nitro::progressandmodal

namespace margelo::nitro {

  // C++ PAM_ToastParams <> JS PAM_ToastParams (object)
  template <>
  struct JSIConverter<margelo::nitro::progressandmodal::PAM_ToastParams> final {
    static inline margelo::nitro::progressandmodal::PAM_ToastParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::progressandmodal::PAM_ToastParams(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textColor"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontSize"))),
        JSIConverter<std::optional<margelo::nitro::progressandmodal::PAM_NativeAssetSource>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageSize"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::progressandmodal::PAM_ToastParams& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"), JSIConverter<std::string>::toJSI(runtime, arg.backgroundColor));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "textColor"), JSIConverter<std::string>::toJSI(runtime, arg.textColor));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.fontSize));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::optional<margelo::nitro::progressandmodal::PAM_NativeAssetSource>>::toJSI(runtime, arg.image));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.imageSize));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.duration));
      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, "message")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textColor")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontSize")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::progressandmodal::PAM_NativeAssetSource>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageSize")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
