///
/// LocaleInfo.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 (LocaleInfo).
   */
  struct LocaleInfo final {
  public:
    std::string languageTag     SWIFT_PRIVATE;
    std::optional<std::string> languageCode     SWIFT_PRIVATE;
    std::optional<std::string> languageScriptCode     SWIFT_PRIVATE;
    std::optional<std::string> regionCode     SWIFT_PRIVATE;
    std::optional<std::string> languageRegionCode     SWIFT_PRIVATE;
    std::optional<std::string> currencyCode     SWIFT_PRIVATE;
    std::optional<std::string> currencySymbol     SWIFT_PRIVATE;
    std::optional<std::string> languageCurrencyCode     SWIFT_PRIVATE;
    std::optional<std::string> languageCurrencySymbol     SWIFT_PRIVATE;
    std::optional<std::string> decimalSeparator     SWIFT_PRIVATE;
    std::optional<std::string> digitGroupingSeparator     SWIFT_PRIVATE;
    std::string textDirection     SWIFT_PRIVATE;
    std::optional<std::string> measurementSystem     SWIFT_PRIVATE;
    std::optional<std::string> temperatureUnit     SWIFT_PRIVATE;

  public:
    LocaleInfo() = default;
    explicit LocaleInfo(std::string languageTag, std::optional<std::string> languageCode, std::optional<std::string> languageScriptCode, std::optional<std::string> regionCode, std::optional<std::string> languageRegionCode, std::optional<std::string> currencyCode, std::optional<std::string> currencySymbol, std::optional<std::string> languageCurrencyCode, std::optional<std::string> languageCurrencySymbol, std::optional<std::string> decimalSeparator, std::optional<std::string> digitGroupingSeparator, std::string textDirection, std::optional<std::string> measurementSystem, std::optional<std::string> temperatureUnit): languageTag(languageTag), languageCode(languageCode), languageScriptCode(languageScriptCode), regionCode(regionCode), languageRegionCode(languageRegionCode), currencyCode(currencyCode), currencySymbol(currencySymbol), languageCurrencyCode(languageCurrencyCode), languageCurrencySymbol(languageCurrencySymbol), decimalSeparator(decimalSeparator), digitGroupingSeparator(digitGroupingSeparator), textDirection(textDirection), measurementSystem(measurementSystem), temperatureUnit(temperatureUnit) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ LocaleInfo <> JS LocaleInfo (object)
  template <>
  struct JSIConverter<margelo::nitro::one::LocaleInfo> final {
    static inline margelo::nitro::one::LocaleInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::LocaleInfo(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageTag"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageScriptCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "regionCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageRegionCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySymbol"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencyCode"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencySymbol"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "decimalSeparator"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "digitGroupingSeparator"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textDirection"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSystem"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temperatureUnit")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::LocaleInfo& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageTag"), JSIConverter<std::string>::toJSI(runtime, arg.languageTag));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.languageCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageScriptCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.languageScriptCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "regionCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.regionCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageRegionCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.languageRegionCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencyCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currencyCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "currencySymbol"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.currencySymbol));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencyCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.languageCurrencyCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencySymbol"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.languageCurrencySymbol));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "decimalSeparator"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.decimalSeparator));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "digitGroupingSeparator"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.digitGroupingSeparator));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "textDirection"), JSIConverter<std::string>::toJSI(runtime, arg.textDirection));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "measurementSystem"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.measurementSystem));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "temperatureUnit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.temperatureUnit));
      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, "languageTag")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageScriptCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "regionCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageRegionCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencyCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currencySymbol")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencyCode")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "languageCurrencySymbol")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "decimalSeparator")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "digitGroupingSeparator")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textDirection")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "measurementSystem")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temperatureUnit")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
