///
/// NativeNotificationAction.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>

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (NativeNotificationAction).
   */
  struct NativeNotificationAction final {
  public:
    std::string identifier     SWIFT_PRIVATE;
    std::string buttonTitle     SWIFT_PRIVATE;
    bool authenticationRequired     SWIFT_PRIVATE;
    bool destructive     SWIFT_PRIVATE;
    bool foreground     SWIFT_PRIVATE;
    std::optional<std::string> textInputPlaceholder     SWIFT_PRIVATE;
    std::optional<std::string> textInputSubmitTitle     SWIFT_PRIVATE;

  public:
    NativeNotificationAction() = default;
    explicit NativeNotificationAction(std::string identifier, std::string buttonTitle, bool authenticationRequired, bool destructive, bool foreground, std::optional<std::string> textInputPlaceholder, std::optional<std::string> textInputSubmitTitle): identifier(identifier), buttonTitle(buttonTitle), authenticationRequired(authenticationRequired), destructive(destructive), foreground(foreground), textInputPlaceholder(textInputPlaceholder), textInputSubmitTitle(textInputSubmitTitle) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ NativeNotificationAction <> JS NativeNotificationAction (object)
  template <>
  struct JSIConverter<margelo::nitro::one::NativeNotificationAction> final {
    static inline margelo::nitro::one::NativeNotificationAction fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::NativeNotificationAction(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "identifier"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "buttonTitle"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authenticationRequired"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "destructive"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "foreground"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textInputPlaceholder"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textInputSubmitTitle")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::NativeNotificationAction& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "identifier"), JSIConverter<std::string>::toJSI(runtime, arg.identifier));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "buttonTitle"), JSIConverter<std::string>::toJSI(runtime, arg.buttonTitle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "authenticationRequired"), JSIConverter<bool>::toJSI(runtime, arg.authenticationRequired));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "destructive"), JSIConverter<bool>::toJSI(runtime, arg.destructive));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "foreground"), JSIConverter<bool>::toJSI(runtime, arg.foreground));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "textInputPlaceholder"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.textInputPlaceholder));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "textInputSubmitTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.textInputSubmitTitle));
      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, "identifier")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "buttonTitle")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authenticationRequired")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "destructive")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "foreground")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textInputPlaceholder")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textInputSubmitTitle")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
