///
/// SensitiveInfoGetRequest.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 `AccessControl` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { enum class AccessControl; }
// Forward declaration of `AuthenticationPrompt` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct AuthenticationPrompt; }

#include <string>
#include <optional>
#include "AccessControl.hpp"
#include "AuthenticationPrompt.hpp"

namespace margelo::nitro::sensitiveinfo {

  /**
   * A struct which can be represented as a JavaScript object (SensitiveInfoGetRequest).
   */
  struct SensitiveInfoGetRequest final {
  public:
    std::string key     SWIFT_PRIVATE;
    std::optional<bool> includeValue     SWIFT_PRIVATE;
    std::optional<std::string> service     SWIFT_PRIVATE;
    std::optional<bool> iosSynchronizable     SWIFT_PRIVATE;
    std::optional<std::string> keychainGroup     SWIFT_PRIVATE;
    std::optional<AccessControl> accessControl     SWIFT_PRIVATE;
    std::optional<AuthenticationPrompt> authenticationPrompt     SWIFT_PRIVATE;

  public:
    SensitiveInfoGetRequest() = default;
    explicit SensitiveInfoGetRequest(std::string key, std::optional<bool> includeValue, std::optional<std::string> service, std::optional<bool> iosSynchronizable, std::optional<std::string> keychainGroup, std::optional<AccessControl> accessControl, std::optional<AuthenticationPrompt> authenticationPrompt): key(key), includeValue(includeValue), service(service), iosSynchronizable(iosSynchronizable), keychainGroup(keychainGroup), accessControl(accessControl), authenticationPrompt(authenticationPrompt) {}

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

} // namespace margelo::nitro::sensitiveinfo

namespace margelo::nitro {

  // C++ SensitiveInfoGetRequest <> JS SensitiveInfoGetRequest (object)
  template <>
  struct JSIConverter<margelo::nitro::sensitiveinfo::SensitiveInfoGetRequest> final {
    static inline margelo::nitro::sensitiveinfo::SensitiveInfoGetRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::sensitiveinfo::SensitiveInfoGetRequest(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "key"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeValue"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "service"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iosSynchronizable"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keychainGroup"))),
        JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AccessControl>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessControl"))),
        JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AuthenticationPrompt>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authenticationPrompt")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::sensitiveinfo::SensitiveInfoGetRequest& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "key"), JSIConverter<std::string>::toJSI(runtime, arg.key));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeValue"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeValue));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "service"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.service));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "iosSynchronizable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.iosSynchronizable));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "keychainGroup"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.keychainGroup));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "accessControl"), JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AccessControl>>::toJSI(runtime, arg.accessControl));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "authenticationPrompt"), JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AuthenticationPrompt>>::toJSI(runtime, arg.authenticationPrompt));
      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, "key")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeValue")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "service")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iosSynchronizable")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keychainGroup")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AccessControl>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessControl")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::sensitiveinfo::AuthenticationPrompt>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authenticationPrompt")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
