///
/// ContactPostalAddressInput.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 (ContactPostalAddressInput).
   */
  struct ContactPostalAddressInput final {
  public:
    std::optional<std::string> label     SWIFT_PRIVATE;
    std::optional<std::string> street     SWIFT_PRIVATE;
    std::optional<std::string> subLocality     SWIFT_PRIVATE;
    std::optional<std::string> city     SWIFT_PRIVATE;
    std::optional<std::string> subAdministrativeArea     SWIFT_PRIVATE;
    std::optional<std::string> state     SWIFT_PRIVATE;
    std::optional<std::string> postalCode     SWIFT_PRIVATE;
    std::optional<std::string> country     SWIFT_PRIVATE;
    std::optional<std::string> isoCountryCode     SWIFT_PRIVATE;

  public:
    ContactPostalAddressInput() = default;
    explicit ContactPostalAddressInput(std::optional<std::string> label, std::optional<std::string> street, std::optional<std::string> subLocality, std::optional<std::string> city, std::optional<std::string> subAdministrativeArea, std::optional<std::string> state, std::optional<std::string> postalCode, std::optional<std::string> country, std::optional<std::string> isoCountryCode): label(label), street(street), subLocality(subLocality), city(city), subAdministrativeArea(subAdministrativeArea), state(state), postalCode(postalCode), country(country), isoCountryCode(isoCountryCode) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ ContactPostalAddressInput <> JS ContactPostalAddressInput (object)
  template <>
  struct JSIConverter<margelo::nitro::one::ContactPostalAddressInput> final {
    static inline margelo::nitro::one::ContactPostalAddressInput fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::ContactPostalAddressInput(
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "label"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "street"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subLocality"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "city"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subAdministrativeArea"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "postalCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "country"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isoCountryCode")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::ContactPostalAddressInput& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "label"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.label));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "street"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.street));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subLocality"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subLocality));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "city"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.city));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subAdministrativeArea"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subAdministrativeArea));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "state"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.state));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "postalCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.postalCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "country"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.country));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isoCountryCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.isoCountryCode));
      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<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "label")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "street")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subLocality")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "city")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subAdministrativeArea")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "postalCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "country")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isoCountryCode")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
