///
/// FaceDetectorOutputOptions.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 `FaceDetectorOutputResolution` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { enum class FaceDetectorOutputResolution; }
// Forward declaration of `HybridFaceSpec` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { class HybridFaceSpec; }
// Forward declaration of `CameraPosition` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { enum class CameraPosition; }
// Forward declaration of `PerformanceMode` to properly resolve imports.
namespace margelo::nitro::camera::facedetector { enum class PerformanceMode; }

#include "FaceDetectorOutputResolution.hpp"
#include <optional>
#include <memory>
#include "HybridFaceSpec.hpp"
#include <vector>
#include <functional>
#include <exception>
#include "CameraPosition.hpp"
#include "PerformanceMode.hpp"

namespace margelo::nitro::camera::facedetector {

  /**
   * A struct which can be represented as a JavaScript object (FaceDetectorOutputOptions).
   */
  struct FaceDetectorOutputOptions final {
  public:
    std::optional<FaceDetectorOutputResolution> outputResolution     SWIFT_PRIVATE;
    std::function<void(const std::vector<std::shared_ptr<HybridFaceSpec>>& /* faces */)> onFacesDetected     SWIFT_PRIVATE;
    std::function<void(const std::exception_ptr& /* error */)> onError     SWIFT_PRIVATE;
    std::optional<CameraPosition> cameraFacing     SWIFT_PRIVATE;
    std::optional<bool> autoMode     SWIFT_PRIVATE;
    std::optional<double> windowWidth     SWIFT_PRIVATE;
    std::optional<double> windowHeight     SWIFT_PRIVATE;
    std::optional<PerformanceMode> performanceMode     SWIFT_PRIVATE;
    std::optional<bool> runLandmarks     SWIFT_PRIVATE;
    std::optional<bool> runContours     SWIFT_PRIVATE;
    std::optional<bool> runClassifications     SWIFT_PRIVATE;
    std::optional<double> minFaceSize     SWIFT_PRIVATE;
    std::optional<bool> trackingEnabled     SWIFT_PRIVATE;

  public:
    FaceDetectorOutputOptions() = default;
    explicit FaceDetectorOutputOptions(std::optional<FaceDetectorOutputResolution> outputResolution, std::function<void(const std::vector<std::shared_ptr<HybridFaceSpec>>& /* faces */)> onFacesDetected, std::function<void(const std::exception_ptr& /* error */)> onError, std::optional<CameraPosition> cameraFacing, std::optional<bool> autoMode, std::optional<double> windowWidth, std::optional<double> windowHeight, std::optional<PerformanceMode> performanceMode, std::optional<bool> runLandmarks, std::optional<bool> runContours, std::optional<bool> runClassifications, std::optional<double> minFaceSize, std::optional<bool> trackingEnabled): outputResolution(outputResolution), onFacesDetected(onFacesDetected), onError(onError), cameraFacing(cameraFacing), autoMode(autoMode), windowWidth(windowWidth), windowHeight(windowHeight), performanceMode(performanceMode), runLandmarks(runLandmarks), runContours(runContours), runClassifications(runClassifications), minFaceSize(minFaceSize), trackingEnabled(trackingEnabled) {}

  public:
    // FaceDetectorOutputOptions is not equatable because these properties are not equatable: onFacesDetected, onError
  };

} // namespace margelo::nitro::camera::facedetector

namespace margelo::nitro {

  // C++ FaceDetectorOutputOptions <> JS FaceDetectorOutputOptions (object)
  template <>
  struct JSIConverter<margelo::nitro::camera::facedetector::FaceDetectorOutputOptions> final {
    static inline margelo::nitro::camera::facedetector::FaceDetectorOutputOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::camera::facedetector::FaceDetectorOutputOptions(
        JSIConverter<std::optional<margelo::nitro::camera::facedetector::FaceDetectorOutputResolution>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputResolution"))),
        JSIConverter<std::function<void(const std::vector<std::shared_ptr<margelo::nitro::camera::facedetector::HybridFaceSpec>>&)>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onFacesDetected"))),
        JSIConverter<std::function<void(const std::exception_ptr&)>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onError"))),
        JSIConverter<std::optional<margelo::nitro::camera::facedetector::CameraPosition>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cameraFacing"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoMode"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "windowWidth"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "windowHeight"))),
        JSIConverter<std::optional<margelo::nitro::camera::facedetector::PerformanceMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "performanceMode"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runLandmarks"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runContours"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runClassifications"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minFaceSize"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trackingEnabled")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::facedetector::FaceDetectorOutputOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "outputResolution"), JSIConverter<std::optional<margelo::nitro::camera::facedetector::FaceDetectorOutputResolution>>::toJSI(runtime, arg.outputResolution));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "onFacesDetected"), JSIConverter<std::function<void(const std::vector<std::shared_ptr<margelo::nitro::camera::facedetector::HybridFaceSpec>>&)>>::toJSI(runtime, arg.onFacesDetected));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "onError"), JSIConverter<std::function<void(const std::exception_ptr&)>>::toJSI(runtime, arg.onError));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "cameraFacing"), JSIConverter<std::optional<margelo::nitro::camera::facedetector::CameraPosition>>::toJSI(runtime, arg.cameraFacing));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoMode"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.autoMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "windowWidth"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.windowWidth));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "windowHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.windowHeight));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "performanceMode"), JSIConverter<std::optional<margelo::nitro::camera::facedetector::PerformanceMode>>::toJSI(runtime, arg.performanceMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "runLandmarks"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.runLandmarks));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "runContours"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.runContours));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "runClassifications"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.runClassifications));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "minFaceSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.minFaceSize));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "trackingEnabled"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.trackingEnabled));
      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::facedetector::FaceDetectorOutputResolution>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outputResolution")))) return false;
      if (!JSIConverter<std::function<void(const std::vector<std::shared_ptr<margelo::nitro::camera::facedetector::HybridFaceSpec>>&)>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onFacesDetected")))) return false;
      if (!JSIConverter<std::function<void(const std::exception_ptr&)>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onError")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::camera::facedetector::CameraPosition>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cameraFacing")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoMode")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "windowWidth")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "windowHeight")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::camera::facedetector::PerformanceMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "performanceMode")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runLandmarks")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runContours")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "runClassifications")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "minFaceSize")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "trackingEnabled")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
