///
/// NativeIosPermissionRequest.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 <optional>

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (NativeIosPermissionRequest).
   */
  struct NativeIosPermissionRequest final {
  public:
    std::optional<bool> allowAlert     SWIFT_PRIVATE;
    std::optional<bool> allowBadge     SWIFT_PRIVATE;
    std::optional<bool> allowSound     SWIFT_PRIVATE;
    std::optional<bool> allowProvisional     SWIFT_PRIVATE;

  public:
    NativeIosPermissionRequest() = default;
    explicit NativeIosPermissionRequest(std::optional<bool> allowAlert, std::optional<bool> allowBadge, std::optional<bool> allowSound, std::optional<bool> allowProvisional): allowAlert(allowAlert), allowBadge(allowBadge), allowSound(allowSound), allowProvisional(allowProvisional) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

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

} // namespace margelo::nitro
