///
/// ElectrocardiogramSample.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 `ElectrocardiogramClassification` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class ElectrocardiogramClassification; }
// Forward declaration of `ElectrocardiogramSymptomsStatus` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class ElectrocardiogramSymptomsStatus; }
// Forward declaration of `ElectrocardiogramVoltage` to properly resolve imports.
namespace margelo::nitro::healthkit { struct ElectrocardiogramVoltage; }
// Forward declaration of `SampleType` to properly resolve imports.
namespace margelo::nitro::healthkit { struct SampleType; }
// Forward declaration of `SourceRevision` to properly resolve imports.
namespace margelo::nitro::healthkit { struct SourceRevision; }
// Forward declaration of `Device` to properly resolve imports.
namespace margelo::nitro::healthkit { struct Device; }

#include "ElectrocardiogramClassification.hpp"
#include "ElectrocardiogramSymptomsStatus.hpp"
#include <optional>
#include "ElectrocardiogramVoltage.hpp"
#include <vector>
#include "SampleType.hpp"
#include <chrono>
#include <NitroModules/AnyMap.hpp>
#include <string>
#include "SourceRevision.hpp"
#include "Device.hpp"

namespace margelo::nitro::healthkit {

  /**
   * A struct which can be represented as a JavaScript object (ElectrocardiogramSample).
   */
  struct ElectrocardiogramSample final {
  public:
    ElectrocardiogramClassification classification     SWIFT_PRIVATE;
    ElectrocardiogramSymptomsStatus symptomsStatus     SWIFT_PRIVATE;
    std::optional<double> averageHeartRateBpm     SWIFT_PRIVATE;
    std::optional<double> samplingFrequencyHz     SWIFT_PRIVATE;
    double numberOfVoltageMeasurements     SWIFT_PRIVATE;
    std::optional<std::vector<ElectrocardiogramVoltage>> voltages     SWIFT_PRIVATE;
    SampleType sampleType     SWIFT_PRIVATE;
    std::chrono::system_clock::time_point startDate     SWIFT_PRIVATE;
    std::chrono::system_clock::time_point endDate     SWIFT_PRIVATE;
    bool hasUndeterminedDuration     SWIFT_PRIVATE;
    std::shared_ptr<AnyMap> metadata     SWIFT_PRIVATE;
    std::string uuid     SWIFT_PRIVATE;
    SourceRevision sourceRevision     SWIFT_PRIVATE;
    std::optional<Device> device     SWIFT_PRIVATE;

  public:
    ElectrocardiogramSample() = default;
    explicit ElectrocardiogramSample(ElectrocardiogramClassification classification, ElectrocardiogramSymptomsStatus symptomsStatus, std::optional<double> averageHeartRateBpm, std::optional<double> samplingFrequencyHz, double numberOfVoltageMeasurements, std::optional<std::vector<ElectrocardiogramVoltage>> voltages, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::shared_ptr<AnyMap> metadata, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device): classification(classification), symptomsStatus(symptomsStatus), averageHeartRateBpm(averageHeartRateBpm), samplingFrequencyHz(samplingFrequencyHz), numberOfVoltageMeasurements(numberOfVoltageMeasurements), voltages(voltages), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadata(metadata), uuid(uuid), sourceRevision(sourceRevision), device(device) {}

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

} // namespace margelo::nitro::healthkit

namespace margelo::nitro {

  // C++ ElectrocardiogramSample <> JS ElectrocardiogramSample (object)
  template <>
  struct JSIConverter<margelo::nitro::healthkit::ElectrocardiogramSample> final {
    static inline margelo::nitro::healthkit::ElectrocardiogramSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::healthkit::ElectrocardiogramSample(
        JSIConverter<margelo::nitro::healthkit::ElectrocardiogramClassification>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "classification"))),
        JSIConverter<margelo::nitro::healthkit::ElectrocardiogramSymptomsStatus>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symptomsStatus"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageHeartRateBpm"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "samplingFrequencyHz"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberOfVoltageMeasurements"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::ElectrocardiogramVoltage>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "voltages"))),
        JSIConverter<margelo::nitro::healthkit::SampleType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleType"))),
        JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
        JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"))),
        JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid"))),
        JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"))),
        JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::ElectrocardiogramSample& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "classification"), JSIConverter<margelo::nitro::healthkit::ElectrocardiogramClassification>::toJSI(runtime, arg.classification));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "symptomsStatus"), JSIConverter<margelo::nitro::healthkit::ElectrocardiogramSymptomsStatus>::toJSI(runtime, arg.symptomsStatus));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "averageHeartRateBpm"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.averageHeartRateBpm));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "samplingFrequencyHz"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.samplingFrequencyHz));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberOfVoltageMeasurements"), JSIConverter<double>::toJSI(runtime, arg.numberOfVoltageMeasurements));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "voltages"), JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::ElectrocardiogramVoltage>>>::toJSI(runtime, arg.voltages));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sampleType"), JSIConverter<margelo::nitro::healthkit::SampleType>::toJSI(runtime, arg.sampleType));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"), JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "uuid"), JSIConverter<std::string>::toJSI(runtime, arg.uuid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"), JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "device"), JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
      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<margelo::nitro::healthkit::ElectrocardiogramClassification>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "classification")))) return false;
      if (!JSIConverter<margelo::nitro::healthkit::ElectrocardiogramSymptomsStatus>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "symptomsStatus")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "averageHeartRateBpm")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "samplingFrequencyHz")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberOfVoltageMeasurements")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::ElectrocardiogramVoltage>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "voltages")))) return false;
      if (!JSIConverter<margelo::nitro::healthkit::SampleType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleType")))) return false;
      if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
      if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration")))) return false;
      if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid")))) return false;
      if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
