///
/// BatchThumbnailOptions.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 `Size` to properly resolve imports.
namespace margelo::nitro::videopipeline { struct Size; }

#include <vector>
#include <string>
#include "Size.hpp"
#include <optional>

namespace margelo::nitro::videopipeline {

  /**
   * A struct which can be represented as a JavaScript object (BatchThumbnailOptions).
   */
  struct BatchThumbnailOptions final {
  public:
    std::vector<double> atSecs     SWIFT_PRIVATE;
    std::vector<std::string> outPaths     SWIFT_PRIVATE;
    std::optional<Size> resizeTo     SWIFT_PRIVATE;
    std::optional<double> toleranceSec     SWIFT_PRIVATE;

  public:
    BatchThumbnailOptions() = default;
    explicit BatchThumbnailOptions(std::vector<double> atSecs, std::vector<std::string> outPaths, std::optional<Size> resizeTo, std::optional<double> toleranceSec): atSecs(atSecs), outPaths(outPaths), resizeTo(resizeTo), toleranceSec(toleranceSec) {}

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

} // namespace margelo::nitro::videopipeline

namespace margelo::nitro {

  // C++ BatchThumbnailOptions <> JS BatchThumbnailOptions (object)
  template <>
  struct JSIConverter<margelo::nitro::videopipeline::BatchThumbnailOptions> final {
    static inline margelo::nitro::videopipeline::BatchThumbnailOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::videopipeline::BatchThumbnailOptions(
        JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "atSecs"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outPaths"))),
        JSIConverter<std::optional<margelo::nitro::videopipeline::Size>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resizeTo"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "toleranceSec")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::videopipeline::BatchThumbnailOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "atSecs"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.atSecs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "outPaths"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.outPaths));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "resizeTo"), JSIConverter<std::optional<margelo::nitro::videopipeline::Size>>::toJSI(runtime, arg.resizeTo));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "toleranceSec"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.toleranceSec));
      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<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "atSecs")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outPaths")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::videopipeline::Size>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resizeTo")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "toleranceSec")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
