///
/// LocationPlace.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 (LocationPlace).
   */
  struct LocationPlace final {
  public:
    double latitude     SWIFT_PRIVATE;
    double longitude     SWIFT_PRIVATE;
    std::optional<std::string> name     SWIFT_PRIVATE;
    std::optional<std::string> street     SWIFT_PRIVATE;
    std::optional<std::string> houseNumber     SWIFT_PRIVATE;
    std::optional<std::string> city     SWIFT_PRIVATE;
    std::optional<std::string> region     SWIFT_PRIVATE;
    std::optional<std::string> postalCode     SWIFT_PRIVATE;
    std::optional<std::string> country     SWIFT_PRIVATE;
    std::optional<std::string> isoCountryCode     SWIFT_PRIVATE;

  public:
    LocationPlace() = default;
    explicit LocationPlace(double latitude, double longitude, std::optional<std::string> name, std::optional<std::string> street, std::optional<std::string> houseNumber, std::optional<std::string> city, std::optional<std::string> region, std::optional<std::string> postalCode, std::optional<std::string> country, std::optional<std::string> isoCountryCode): latitude(latitude), longitude(longitude), name(name), street(street), houseNumber(houseNumber), city(city), region(region), postalCode(postalCode), country(country), isoCountryCode(isoCountryCode) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ LocationPlace <> JS LocationPlace (object)
  template <>
  struct JSIConverter<margelo::nitro::one::LocationPlace> final {
    static inline margelo::nitro::one::LocationPlace fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::LocationPlace(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
        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, "houseNumber"))),
        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, "region"))),
        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::LocationPlace& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<double>::toJSI(runtime, arg.latitude));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<double>::toJSI(runtime, arg.longitude));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.name));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "street"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.street));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "houseNumber"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.houseNumber));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "city"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.city));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "region"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.region));
      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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) 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, "houseNumber")))) 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, "region")))) 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
