///
/// OneTapUser.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 <NitroModules/Null.hpp>
#include <variant>
#include <optional>

namespace margelo::nitro::nitrogooglesignin {

  /**
   * A struct which can be represented as a JavaScript object (OneTapUser).
   */
  struct OneTapUser final {
  public:
    std::string id     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> email     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> name     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> givenName     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> familyName     SWIFT_PRIVATE;
    std::optional<std::variant<nitro::NullType, std::string>> photo     SWIFT_PRIVATE;

  public:
    OneTapUser() = default;
    explicit OneTapUser(std::string id, std::optional<std::variant<nitro::NullType, std::string>> email, std::optional<std::variant<nitro::NullType, std::string>> name, std::optional<std::variant<nitro::NullType, std::string>> givenName, std::optional<std::variant<nitro::NullType, std::string>> familyName, std::optional<std::variant<nitro::NullType, std::string>> photo): id(id), email(email), name(name), givenName(givenName), familyName(familyName), photo(photo) {}

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

} // namespace margelo::nitro::nitrogooglesignin

namespace margelo::nitro {

  // C++ OneTapUser <> JS OneTapUser (object)
  template <>
  struct JSIConverter<margelo::nitro::nitrogooglesignin::OneTapUser> final {
    static inline margelo::nitro::nitrogooglesignin::OneTapUser fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitrogooglesignin::OneTapUser(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "givenName"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "familyName"))),
        JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "photo")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrogooglesignin::OneTapUser& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "email"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.email));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.name));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "givenName"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.givenName));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "familyName"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.familyName));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "photo"), JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::toJSI(runtime, arg.photo));
      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, "id")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "email")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "givenName")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "familyName")))) return false;
      if (!JSIConverter<std::optional<std::variant<nitro::NullType, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "photo")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
