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



#include <optional>

namespace margelo::nitro::hypermarkdown {

  /**
   * A struct which can be represented as a JavaScript object (ParserOptions).
   */
  struct ParserOptions final {
  public:
    std::optional<bool> gfm     SWIFT_PRIVATE;
    std::optional<bool> enableTables     SWIFT_PRIVATE;
    std::optional<bool> enableTaskLists     SWIFT_PRIVATE;
    std::optional<bool> enableStrikethrough     SWIFT_PRIVATE;
    std::optional<bool> enableAutolink     SWIFT_PRIVATE;
    std::optional<bool> math     SWIFT_PRIVATE;
    std::optional<bool> wiki     SWIFT_PRIVATE;
    std::optional<double> maxInputSize     SWIFT_PRIVATE;
    std::optional<double> timeout     SWIFT_PRIVATE;

  public:
    ParserOptions() = default;
    explicit ParserOptions(std::optional<bool> gfm, std::optional<bool> enableTables, std::optional<bool> enableTaskLists, std::optional<bool> enableStrikethrough, std::optional<bool> enableAutolink, std::optional<bool> math, std::optional<bool> wiki, std::optional<double> maxInputSize, std::optional<double> timeout): gfm(gfm), enableTables(enableTables), enableTaskLists(enableTaskLists), enableStrikethrough(enableStrikethrough), enableAutolink(enableAutolink), math(math), wiki(wiki), maxInputSize(maxInputSize), timeout(timeout) {}

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

} // namespace margelo::nitro::hypermarkdown

namespace margelo::nitro {

  // C++ ParserOptions <> JS ParserOptions (object)
  template <>
  struct JSIConverter<margelo::nitro::hypermarkdown::ParserOptions> final {
    static inline margelo::nitro::hypermarkdown::ParserOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::hypermarkdown::ParserOptions(
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gfm"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableTables"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableTaskLists"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableStrikethrough"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableAutolink"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "math"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wiki"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxInputSize"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::hypermarkdown::ParserOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "gfm"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.gfm));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableTables"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableTables));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableTaskLists"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableTaskLists));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableStrikethrough"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableStrikethrough));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableAutolink"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableAutolink));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "math"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.math));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "wiki"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.wiki));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxInputSize"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxInputSize));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeout"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeout));
      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<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "gfm")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableTables")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableTaskLists")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableStrikethrough")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableAutolink")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "math")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "wiki")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxInputSize")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
