/// /// NativeHealthKitContext.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() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif #if __has_include() #include #else #error NitroModules cannot be found! Are you sure you installed NitroModules properly? #endif // Forward declaration of `NativeHealthMetricSample` to properly resolve imports. namespace margelo::nitro::haptika::ppg { struct NativeHealthMetricSample; } #include "NativeHealthMetricSample.hpp" #include #include #include namespace margelo::nitro::haptika::ppg { /** * A struct which can be represented as a JavaScript object (NativeHealthKitContext). */ struct NativeHealthKitContext final { public: bool available SWIFT_PRIVATE; bool authorized SWIFT_PRIVATE; std::optional latestRestingHeartRate SWIFT_PRIVATE; std::optional latestHrvSdnn SWIFT_PRIVATE; std::vector recentHeartRateSamples SWIFT_PRIVATE; double contextConfidence SWIFT_PRIVATE; std::string fetchedAt SWIFT_PRIVATE; public: NativeHealthKitContext() = default; explicit NativeHealthKitContext(bool available, bool authorized, std::optional latestRestingHeartRate, std::optional latestHrvSdnn, std::vector recentHeartRateSamples, double contextConfidence, std::string fetchedAt): available(available), authorized(authorized), latestRestingHeartRate(latestRestingHeartRate), latestHrvSdnn(latestHrvSdnn), recentHeartRateSamples(recentHeartRateSamples), contextConfidence(contextConfidence), fetchedAt(fetchedAt) {} public: friend bool operator==(const NativeHealthKitContext& lhs, const NativeHealthKitContext& rhs) = default; }; } // namespace margelo::nitro::haptika::ppg namespace margelo::nitro { // C++ NativeHealthKitContext <> JS NativeHealthKitContext (object) template <> struct JSIConverter final { static inline margelo::nitro::haptika::ppg::NativeHealthKitContext fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); return margelo::nitro::haptika::ppg::NativeHealthKitContext( JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authorized"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn"))), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence"))), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt"))) ); } static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::haptika::ppg::NativeHealthKitContext& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, PropNameIDCache::get(runtime, "available"), JSIConverter::toJSI(runtime, arg.available)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "authorized"), JSIConverter::toJSI(runtime, arg.authorized)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate"), JSIConverter>::toJSI(runtime, arg.latestRestingHeartRate)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn"), JSIConverter>::toJSI(runtime, arg.latestHrvSdnn)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples"), JSIConverter>::toJSI(runtime, arg.recentHeartRateSamples)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence"), JSIConverter::toJSI(runtime, arg.contextConfidence)); obj.setProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt"), JSIConverter::toJSI(runtime, arg.fetchedAt)); 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::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "available")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "authorized")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestRestingHeartRate")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latestHrvSdnn")))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recentHeartRateSamples")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contextConfidence")))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fetchedAt")))) return false; return true; } }; } // namespace margelo::nitro