///
/// WorkoutRouteLocation.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 <chrono>
#include <optional>

namespace margelo::nitro::healthkit {

  /**
   * A struct which can be represented as a JavaScript object (WorkoutRouteLocation).
   */
  struct WorkoutRouteLocation final {
  public:
    double altitude     SWIFT_PRIVATE;
    double course     SWIFT_PRIVATE;
    std::chrono::system_clock::time_point date     SWIFT_PRIVATE;
    std::optional<double> distance     SWIFT_PRIVATE;
    double horizontalAccuracy     SWIFT_PRIVATE;
    double latitude     SWIFT_PRIVATE;
    double longitude     SWIFT_PRIVATE;
    double speed     SWIFT_PRIVATE;
    double speedAccuracy     SWIFT_PRIVATE;
    double verticalAccuracy     SWIFT_PRIVATE;

  public:
    WorkoutRouteLocation() = default;
    explicit WorkoutRouteLocation(double altitude, double course, std::chrono::system_clock::time_point date, std::optional<double> distance, double horizontalAccuracy, double latitude, double longitude, double speed, double speedAccuracy, double verticalAccuracy): altitude(altitude), course(course), date(date), distance(distance), horizontalAccuracy(horizontalAccuracy), latitude(latitude), longitude(longitude), speed(speed), speedAccuracy(speedAccuracy), verticalAccuracy(verticalAccuracy) {}

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

} // namespace margelo::nitro::healthkit

namespace margelo::nitro {

  // C++ WorkoutRouteLocation <> JS WorkoutRouteLocation (object)
  template <>
  struct JSIConverter<margelo::nitro::healthkit::WorkoutRouteLocation> final {
    static inline margelo::nitro::healthkit::WorkoutRouteLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::healthkit::WorkoutRouteLocation(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "altitude"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "course"))),
        JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "horizontalAccuracy"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speed"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speedAccuracy"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "verticalAccuracy")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutRouteLocation& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "altitude"), JSIConverter<double>::toJSI(runtime, arg.altitude));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "course"), JSIConverter<double>::toJSI(runtime, arg.course));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "date"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.date));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "distance"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.distance));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "horizontalAccuracy"), JSIConverter<double>::toJSI(runtime, arg.horizontalAccuracy));
      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, "speed"), JSIConverter<double>::toJSI(runtime, arg.speed));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "speedAccuracy"), JSIConverter<double>::toJSI(runtime, arg.speedAccuracy));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "verticalAccuracy"), JSIConverter<double>::toJSI(runtime, arg.verticalAccuracy));
      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, "altitude")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "course")))) return false;
      if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "date")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "horizontalAccuracy")))) 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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speed")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speedAccuracy")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "verticalAccuracy")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
