///
/// QueryWorkoutSamplesWithAnchorResponse.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

// Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
// Forward declaration of `DeletedSample` to properly resolve imports.
namespace margelo::nitro::healthkit { struct DeletedSample; }

#include <memory>
#include "HybridWorkoutProxySpec.hpp"
#include <vector>
#include "DeletedSample.hpp"
#include <string>

namespace margelo::nitro::healthkit {

  /**
   * A struct which can be represented as a JavaScript object (QueryWorkoutSamplesWithAnchorResponse).
   */
  struct QueryWorkoutSamplesWithAnchorResponse final {
  public:
    std::vector<std::shared_ptr<HybridWorkoutProxySpec>> workouts     SWIFT_PRIVATE;
    std::vector<DeletedSample> deletedSamples     SWIFT_PRIVATE;
    std::string newAnchor     SWIFT_PRIVATE;

  public:
    QueryWorkoutSamplesWithAnchorResponse() = default;
    explicit QueryWorkoutSamplesWithAnchorResponse(std::vector<std::shared_ptr<HybridWorkoutProxySpec>> workouts, std::vector<DeletedSample> deletedSamples, std::string newAnchor): workouts(workouts), deletedSamples(deletedSamples), newAnchor(newAnchor) {}

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

} // namespace margelo::nitro::healthkit

namespace margelo::nitro {

  // C++ QueryWorkoutSamplesWithAnchorResponse <> JS QueryWorkoutSamplesWithAnchorResponse (object)
  template <>
  struct JSIConverter<margelo::nitro::healthkit::QueryWorkoutSamplesWithAnchorResponse> final {
    static inline margelo::nitro::healthkit::QueryWorkoutSamplesWithAnchorResponse fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::healthkit::QueryWorkoutSamplesWithAnchorResponse(
        JSIConverter<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "workouts"))),
        JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedSamples"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "newAnchor")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryWorkoutSamplesWithAnchorResponse& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "workouts"), JSIConverter<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>::toJSI(runtime, arg.workouts));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "deletedSamples"), JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::toJSI(runtime, arg.deletedSamples));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "newAnchor"), JSIConverter<std::string>::toJSI(runtime, arg.newAnchor));
      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::vector<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "workouts")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::healthkit::DeletedSample>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedSamples")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "newAnchor")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
