///
/// CapturePhotoSettings.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 `FlashMode` to properly resolve imports.
namespace margelo::nitro::camera { enum class FlashMode; }
// Forward declaration of `HybridLocationSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridLocationSpec; }

#include "FlashMode.hpp"
#include <optional>
#include <memory>
#include "HybridLocationSpec.hpp"

namespace margelo::nitro::camera {

  /**
   * A struct which can be represented as a JavaScript object (CapturePhotoSettings).
   */
  struct CapturePhotoSettings final {
  public:
    std::optional<FlashMode> flashMode     SWIFT_PRIVATE;
    std::optional<bool> enableShutterSound     SWIFT_PRIVATE;
    std::optional<bool> enableDepthData     SWIFT_PRIVATE;
    std::optional<bool> enableRedEyeReduction     SWIFT_PRIVATE;
    std::optional<bool> enableCameraCalibrationDataDelivery     SWIFT_PRIVATE;
    std::optional<bool> enableDistortionCorrection     SWIFT_PRIVATE;
    std::optional<bool> enableVirtualDeviceFusion     SWIFT_PRIVATE;
    std::optional<std::shared_ptr<HybridLocationSpec>> location     SWIFT_PRIVATE;

  public:
    CapturePhotoSettings() = default;
    explicit CapturePhotoSettings(std::optional<FlashMode> flashMode, std::optional<bool> enableShutterSound, std::optional<bool> enableDepthData, std::optional<bool> enableRedEyeReduction, std::optional<bool> enableCameraCalibrationDataDelivery, std::optional<bool> enableDistortionCorrection, std::optional<bool> enableVirtualDeviceFusion, std::optional<std::shared_ptr<HybridLocationSpec>> location): flashMode(flashMode), enableShutterSound(enableShutterSound), enableDepthData(enableDepthData), enableRedEyeReduction(enableRedEyeReduction), enableCameraCalibrationDataDelivery(enableCameraCalibrationDataDelivery), enableDistortionCorrection(enableDistortionCorrection), enableVirtualDeviceFusion(enableVirtualDeviceFusion), location(location) {}

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

} // namespace margelo::nitro::camera

namespace margelo::nitro {

  // C++ CapturePhotoSettings <> JS CapturePhotoSettings (object)
  template <>
  struct JSIConverter<margelo::nitro::camera::CapturePhotoSettings> final {
    static inline margelo::nitro::camera::CapturePhotoSettings fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::camera::CapturePhotoSettings(
        JSIConverter<std::optional<margelo::nitro::camera::FlashMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flashMode"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableShutterSound"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableDepthData"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRedEyeReduction"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableCameraCalibrationDataDelivery"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableDistortionCorrection"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableVirtualDeviceFusion"))),
        JSIConverter<std::optional<std::shared_ptr<margelo::nitro::camera::HybridLocationSpec>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::CapturePhotoSettings& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "flashMode"), JSIConverter<std::optional<margelo::nitro::camera::FlashMode>>::toJSI(runtime, arg.flashMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableShutterSound"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableShutterSound));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableDepthData"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableDepthData));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableRedEyeReduction"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableRedEyeReduction));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableCameraCalibrationDataDelivery"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableCameraCalibrationDataDelivery));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableDistortionCorrection"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableDistortionCorrection));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableVirtualDeviceFusion"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableVirtualDeviceFusion));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "location"), JSIConverter<std::optional<std::shared_ptr<margelo::nitro::camera::HybridLocationSpec>>>::toJSI(runtime, arg.location));
      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::optional<margelo::nitro::camera::FlashMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "flashMode")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableShutterSound")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableDepthData")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRedEyeReduction")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableCameraCalibrationDataDelivery")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableDistortionCorrection")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableVirtualDeviceFusion")))) return false;
      if (!JSIConverter<std::optional<std::shared_ptr<margelo::nitro::camera::HybridLocationSpec>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
