///
/// HttpDeleteParams.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



#include <string>

namespace margelo::nitro::nitrotor {

  /**
   * A struct which can be represented as a JavaScript object (HttpDeleteParams).
   */
  struct HttpDeleteParams {
  public:
    std::string url     SWIFT_PRIVATE;
    std::string headers     SWIFT_PRIVATE;
    double timeout_ms     SWIFT_PRIVATE;

  public:
    HttpDeleteParams() = default;
    explicit HttpDeleteParams(std::string url, std::string headers, double timeout_ms): url(url), headers(headers), timeout_ms(timeout_ms) {}
  };

} // namespace margelo::nitro::nitrotor

namespace margelo::nitro {

  using namespace margelo::nitro::nitrotor;

  // C++ HttpDeleteParams <> JS HttpDeleteParams (object)
  template <>
  struct JSIConverter<HttpDeleteParams> final {
    static inline HttpDeleteParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return HttpDeleteParams(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "url")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "headers")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timeout_ms"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const HttpDeleteParams& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "url", JSIConverter<std::string>::toJSI(runtime, arg.url));
      obj.setProperty(runtime, "headers", JSIConverter<std::string>::toJSI(runtime, arg.headers));
      obj.setProperty(runtime, "timeout_ms", JSIConverter<double>::toJSI(runtime, arg.timeout_ms));
      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::string>::canConvert(runtime, obj.getProperty(runtime, "url"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "headers"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timeout_ms"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
