///
/// NativeFilePickerOptions.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2024 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



#include <optional>
#include <string>
#include <vector>

namespace margelo::nitro::fastio {

  /**
   * A struct which can be represented as a JavaScript object (NativeFilePickerOptions).
   */
  struct NativeFilePickerOptions {
  public:
    std::optional<bool> multiple     SWIFT_PRIVATE;
    std::optional<std::string> startIn     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> extensions     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> mimeTypes     SWIFT_PRIVATE;

  public:
    explicit NativeFilePickerOptions(std::optional<bool> multiple, std::optional<std::string> startIn, std::optional<std::vector<std::string>> extensions, std::optional<std::vector<std::string>> mimeTypes): multiple(multiple), startIn(startIn), extensions(extensions), mimeTypes(mimeTypes) {}
  };

} // namespace margelo::nitro::fastio

namespace margelo::nitro {

  using namespace margelo::nitro::fastio;

  // C++ NativeFilePickerOptions <> JS NativeFilePickerOptions (object)
  template <>
  struct JSIConverter<NativeFilePickerOptions> {
    static inline NativeFilePickerOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return NativeFilePickerOptions(
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "multiple")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "startIn")),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "extensions")),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "mimeTypes"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const NativeFilePickerOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "multiple", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.multiple));
      obj.setProperty(runtime, "startIn", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.startIn));
      obj.setProperty(runtime, "extensions", JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.extensions));
      obj.setProperty(runtime, "mimeTypes", JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.mimeTypes));
      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 (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "multiple"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "startIn"))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, "extensions"))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, "mimeTypes"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
