///
/// DataScannerConfiguration.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 `DataScannerRecognizedDataType` to properly resolve imports.
namespace margelo::nitro::one { struct DataScannerRecognizedDataType; }
// Forward declaration of `DataScannerQualityLevel` to properly resolve imports.
namespace margelo::nitro::one { enum class DataScannerQualityLevel; }

#include "DataScannerRecognizedDataType.hpp"
#include <vector>
#include "DataScannerQualityLevel.hpp"

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (DataScannerConfiguration).
   */
  struct DataScannerConfiguration final {
  public:
    std::vector<DataScannerRecognizedDataType> recognizedDataTypes     SWIFT_PRIVATE;
    DataScannerQualityLevel qualityLevel     SWIFT_PRIVATE;
    bool recognizesMultipleItems     SWIFT_PRIVATE;
    bool isHighFrameRateTrackingEnabled     SWIFT_PRIVATE;
    bool isPinchToZoomEnabled     SWIFT_PRIVATE;
    bool isGuidanceEnabled     SWIFT_PRIVATE;
    bool isHighlightingEnabled     SWIFT_PRIVATE;

  public:
    DataScannerConfiguration() = default;
    explicit DataScannerConfiguration(std::vector<DataScannerRecognizedDataType> recognizedDataTypes, DataScannerQualityLevel qualityLevel, bool recognizesMultipleItems, bool isHighFrameRateTrackingEnabled, bool isPinchToZoomEnabled, bool isGuidanceEnabled, bool isHighlightingEnabled): recognizedDataTypes(recognizedDataTypes), qualityLevel(qualityLevel), recognizesMultipleItems(recognizesMultipleItems), isHighFrameRateTrackingEnabled(isHighFrameRateTrackingEnabled), isPinchToZoomEnabled(isPinchToZoomEnabled), isGuidanceEnabled(isGuidanceEnabled), isHighlightingEnabled(isHighlightingEnabled) {}

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

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ DataScannerConfiguration <> JS DataScannerConfiguration (object)
  template <>
  struct JSIConverter<margelo::nitro::one::DataScannerConfiguration> final {
    static inline margelo::nitro::one::DataScannerConfiguration fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::DataScannerConfiguration(
        JSIConverter<std::vector<margelo::nitro::one::DataScannerRecognizedDataType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recognizedDataTypes"))),
        JSIConverter<margelo::nitro::one::DataScannerQualityLevel>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "qualityLevel"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recognizesMultipleItems"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHighFrameRateTrackingEnabled"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPinchToZoomEnabled"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isGuidanceEnabled"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHighlightingEnabled")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::DataScannerConfiguration& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "recognizedDataTypes"), JSIConverter<std::vector<margelo::nitro::one::DataScannerRecognizedDataType>>::toJSI(runtime, arg.recognizedDataTypes));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "qualityLevel"), JSIConverter<margelo::nitro::one::DataScannerQualityLevel>::toJSI(runtime, arg.qualityLevel));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "recognizesMultipleItems"), JSIConverter<bool>::toJSI(runtime, arg.recognizesMultipleItems));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isHighFrameRateTrackingEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isHighFrameRateTrackingEnabled));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPinchToZoomEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isPinchToZoomEnabled));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isGuidanceEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isGuidanceEnabled));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isHighlightingEnabled"), JSIConverter<bool>::toJSI(runtime, arg.isHighlightingEnabled));
      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::vector<margelo::nitro::one::DataScannerRecognizedDataType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recognizedDataTypes")))) return false;
      if (!JSIConverter<margelo::nitro::one::DataScannerQualityLevel>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "qualityLevel")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "recognizesMultipleItems")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHighFrameRateTrackingEnabled")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPinchToZoomEnabled")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isGuidanceEnabled")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHighlightingEnabled")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
