///
/// NativeChannelInput.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 <vector>

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (NativeChannelInput).
   */
  struct NativeChannelInput final {
  public:
    std::string name     SWIFT_PRIVATE;
    double importance     SWIFT_PRIVATE;
    std::optional<std::string> description     SWIFT_PRIVATE;
    std::optional<bool> sound     SWIFT_PRIVATE;
    std::optional<std::vector<double>> vibrationPattern     SWIFT_PRIVATE;
    std::optional<bool> showBadge     SWIFT_PRIVATE;

  public:
    NativeChannelInput() = default;
    explicit NativeChannelInput(std::string name, double importance, std::optional<std::string> description, std::optional<bool> sound, std::optional<std::vector<double>> vibrationPattern, std::optional<bool> showBadge): name(name), importance(importance), description(description), sound(sound), vibrationPattern(vibrationPattern), showBadge(showBadge) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ NativeChannelInput <> JS NativeChannelInput (object)
  template <>
  struct JSIConverter<margelo::nitro::one::NativeChannelInput> final {
    static inline margelo::nitro::one::NativeChannelInput fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::NativeChannelInput(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "importance"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sound"))),
        JSIConverter<std::optional<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vibrationPattern"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showBadge")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::NativeChannelInput& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "importance"), JSIConverter<double>::toJSI(runtime, arg.importance));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.description));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sound"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.sound));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "vibrationPattern"), JSIConverter<std::optional<std::vector<double>>>::toJSI(runtime, arg.vibrationPattern));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "showBadge"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showBadge));
      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, "name")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "importance")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sound")))) return false;
      if (!JSIConverter<std::optional<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vibrationPattern")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showBadge")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
