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



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

namespace margelo::nitro::pngutils {

  /**
   * A struct which can be represented as a JavaScript object (ExtractPngChunksOptions).
   */
  struct ExtractPngChunksOptions {
  public:
    std::optional<std::vector<std::string>> keywords     SWIFT_PRIVATE;
    std::optional<bool> decodeBase64     SWIFT_PRIVATE;

  public:
    ExtractPngChunksOptions() = default;
    explicit ExtractPngChunksOptions(std::optional<std::vector<std::string>> keywords, std::optional<bool> decodeBase64): keywords(keywords), decodeBase64(decodeBase64) {}
  };

} // namespace margelo::nitro::pngutils

namespace margelo::nitro {

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

} // namespace margelo::nitro
