///
/// CameraSessionConnection.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 `HybridCameraDeviceSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraDeviceSpec; }
// Forward declaration of `CameraOutputConfiguration` to properly resolve imports.
namespace margelo::nitro::camera { struct CameraOutputConfiguration; }
// Forward declaration of `FPSConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct FPSConstraint; }
// Forward declaration of `VideoStabilizationModeConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct VideoStabilizationModeConstraint; }
// Forward declaration of `PreviewStabilizationModeConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct PreviewStabilizationModeConstraint; }
// Forward declaration of `ResolutionBiasConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct ResolutionBiasConstraint; }
// Forward declaration of `VideoDynamicRangeConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct VideoDynamicRangeConstraint; }
// Forward declaration of `PhotoHDRConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct PhotoHDRConstraint; }
// Forward declaration of `PixelFormatConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct PixelFormatConstraint; }
// Forward declaration of `BinnedConstraint` to properly resolve imports.
namespace margelo::nitro::camera { struct BinnedConstraint; }
// Forward declaration of `HybridCameraSessionConfigSpec` to properly resolve imports.
namespace margelo::nitro::camera { class HybridCameraSessionConfigSpec; }

#include <memory>
#include "HybridCameraDeviceSpec.hpp"
#include "CameraOutputConfiguration.hpp"
#include <vector>
#include "FPSConstraint.hpp"
#include "VideoStabilizationModeConstraint.hpp"
#include "PreviewStabilizationModeConstraint.hpp"
#include "ResolutionBiasConstraint.hpp"
#include "VideoDynamicRangeConstraint.hpp"
#include "PhotoHDRConstraint.hpp"
#include "PixelFormatConstraint.hpp"
#include "BinnedConstraint.hpp"
#include <variant>
#include <optional>
#include "HybridCameraSessionConfigSpec.hpp"
#include <functional>

namespace margelo::nitro::camera {

  /**
   * A struct which can be represented as a JavaScript object (CameraSessionConnection).
   */
  struct CameraSessionConnection final {
  public:
    std::shared_ptr<HybridCameraDeviceSpec> input     SWIFT_PRIVATE;
    std::vector<CameraOutputConfiguration> outputs     SWIFT_PRIVATE;
    std::vector<std::variant<FPSConstraint, VideoStabilizationModeConstraint, PreviewStabilizationModeConstraint, ResolutionBiasConstraint, VideoDynamicRangeConstraint, PhotoHDRConstraint, PixelFormatConstraint, BinnedConstraint>> constraints     SWIFT_PRIVATE;
    std::optional<double> initialZoom     SWIFT_PRIVATE;
    std::optional<double> initialExposureBias     SWIFT_PRIVATE;
    std::optional<std::function<void(const std::shared_ptr<HybridCameraSessionConfigSpec>& /* config */)>> onSessionConfigSelected     SWIFT_PRIVATE;

  public:
    CameraSessionConnection() = default;
    explicit CameraSessionConnection(std::shared_ptr<HybridCameraDeviceSpec> input, std::vector<CameraOutputConfiguration> outputs, std::vector<std::variant<FPSConstraint, VideoStabilizationModeConstraint, PreviewStabilizationModeConstraint, ResolutionBiasConstraint, VideoDynamicRangeConstraint, PhotoHDRConstraint, PixelFormatConstraint, BinnedConstraint>> constraints, std::optional<double> initialZoom, std::optional<double> initialExposureBias, std::optional<std::function<void(const std::shared_ptr<HybridCameraSessionConfigSpec>& /* config */)>> onSessionConfigSelected): input(input), outputs(outputs), constraints(constraints), initialZoom(initialZoom), initialExposureBias(initialExposureBias), onSessionConfigSelected(onSessionConfigSelected) {}

  public:
    // CameraSessionConnection is not equatable because these properties are not equatable: onSessionConfigSelected
  };

} // namespace margelo::nitro::camera

namespace margelo::nitro {

  // C++ CameraSessionConnection <> JS CameraSessionConnection (object)
  template <>
  struct JSIConverter<margelo::nitro::camera::CameraSessionConnection> final {
    static inline margelo::nitro::camera::CameraSessionConnection fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::camera::CameraSessionConnection(
        JSIConverter<std::shared_ptr<margelo::nitro::camera::HybridCameraDeviceSpec>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "input"))),
        JSIConverter<std::vector<margelo::nitro::camera::CameraOutputConfiguration>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputs"))),
        JSIConverter<std::vector<std::variant<margelo::nitro::camera::FPSConstraint, margelo::nitro::camera::VideoStabilizationModeConstraint, margelo::nitro::camera::PreviewStabilizationModeConstraint, margelo::nitro::camera::ResolutionBiasConstraint, margelo::nitro::camera::VideoDynamicRangeConstraint, margelo::nitro::camera::PhotoHDRConstraint, margelo::nitro::camera::PixelFormatConstraint, margelo::nitro::camera::BinnedConstraint>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "constraints"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialZoom"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialExposureBias"))),
        JSIConverter<std::optional<std::function<void(const std::shared_ptr<margelo::nitro::camera::HybridCameraSessionConfigSpec>&)>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onSessionConfigSelected")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::CameraSessionConnection& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "input"), JSIConverter<std::shared_ptr<margelo::nitro::camera::HybridCameraDeviceSpec>>::toJSI(runtime, arg.input));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "outputs"), JSIConverter<std::vector<margelo::nitro::camera::CameraOutputConfiguration>>::toJSI(runtime, arg.outputs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "constraints"), JSIConverter<std::vector<std::variant<margelo::nitro::camera::FPSConstraint, margelo::nitro::camera::VideoStabilizationModeConstraint, margelo::nitro::camera::PreviewStabilizationModeConstraint, margelo::nitro::camera::ResolutionBiasConstraint, margelo::nitro::camera::VideoDynamicRangeConstraint, margelo::nitro::camera::PhotoHDRConstraint, margelo::nitro::camera::PixelFormatConstraint, margelo::nitro::camera::BinnedConstraint>>>::toJSI(runtime, arg.constraints));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "initialZoom"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.initialZoom));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "initialExposureBias"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.initialExposureBias));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "onSessionConfigSelected"), JSIConverter<std::optional<std::function<void(const std::shared_ptr<margelo::nitro::camera::HybridCameraSessionConfigSpec>&)>>>::toJSI(runtime, arg.onSessionConfigSelected));
      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::shared_ptr<margelo::nitro::camera::HybridCameraDeviceSpec>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "input")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::camera::CameraOutputConfiguration>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputs")))) return false;
      if (!JSIConverter<std::vector<std::variant<margelo::nitro::camera::FPSConstraint, margelo::nitro::camera::VideoStabilizationModeConstraint, margelo::nitro::camera::PreviewStabilizationModeConstraint, margelo::nitro::camera::ResolutionBiasConstraint, margelo::nitro::camera::VideoDynamicRangeConstraint, margelo::nitro::camera::PhotoHDRConstraint, margelo::nitro::camera::PixelFormatConstraint, margelo::nitro::camera::BinnedConstraint>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "constraints")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialZoom")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "initialExposureBias")))) return false;
      if (!JSIConverter<std::optional<std::function<void(const std::shared_ptr<margelo::nitro::camera::HybridCameraSessionConfigSpec>&)>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onSessionConfigSelected")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
