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



#include <string>
#include <optional>

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (BarkConfigOpts).
   */
  struct BarkConfigOpts final {
  public:
    std::string ark     SWIFT_PRIVATE;
    std::optional<std::string> user_agent     SWIFT_PRIVATE;
    std::optional<std::string> esplora     SWIFT_PRIVATE;
    std::optional<std::string> bitcoind     SWIFT_PRIVATE;
    std::optional<std::string> bitcoind_cookie     SWIFT_PRIVATE;
    std::optional<std::string> bitcoind_user     SWIFT_PRIVATE;
    std::optional<std::string> bitcoind_pass     SWIFT_PRIVATE;
    double vtxo_refresh_expiry_threshold     SWIFT_PRIVATE;
    std::optional<double> vtxo_key_gap_limit     SWIFT_PRIVATE;
    double fallback_fee_rate     SWIFT_PRIVATE;
    double htlc_recv_claim_delta     SWIFT_PRIVATE;
    double vtxo_exit_margin     SWIFT_PRIVATE;
    double round_tx_required_confirmations     SWIFT_PRIVATE;

  public:
    BarkConfigOpts() = default;
    explicit BarkConfigOpts(std::string ark, std::optional<std::string> user_agent, std::optional<std::string> esplora, std::optional<std::string> bitcoind, std::optional<std::string> bitcoind_cookie, std::optional<std::string> bitcoind_user, std::optional<std::string> bitcoind_pass, double vtxo_refresh_expiry_threshold, std::optional<double> vtxo_key_gap_limit, double fallback_fee_rate, double htlc_recv_claim_delta, double vtxo_exit_margin, double round_tx_required_confirmations): ark(ark), user_agent(user_agent), esplora(esplora), bitcoind(bitcoind), bitcoind_cookie(bitcoind_cookie), bitcoind_user(bitcoind_user), bitcoind_pass(bitcoind_pass), vtxo_refresh_expiry_threshold(vtxo_refresh_expiry_threshold), vtxo_key_gap_limit(vtxo_key_gap_limit), fallback_fee_rate(fallback_fee_rate), htlc_recv_claim_delta(htlc_recv_claim_delta), vtxo_exit_margin(vtxo_exit_margin), round_tx_required_confirmations(round_tx_required_confirmations) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ BarkConfigOpts <> JS BarkConfigOpts (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::BarkConfigOpts> final {
    static inline margelo::nitro::nitroark::BarkConfigOpts fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::BarkConfigOpts(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ark"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user_agent"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "esplora"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_cookie"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_user"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_pass"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_refresh_expiry_threshold"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_key_gap_limit"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fallback_fee_rate"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_recv_claim_delta"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_margin"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "round_tx_required_confirmations")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BarkConfigOpts& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "ark"), JSIConverter<std::string>::toJSI(runtime, arg.ark));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "user_agent"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.user_agent));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "esplora"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.esplora));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitcoind"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_cookie"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_cookie));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_user"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_user));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_pass"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.bitcoind_pass));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_refresh_expiry_threshold"), JSIConverter<double>::toJSI(runtime, arg.vtxo_refresh_expiry_threshold));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_key_gap_limit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.vtxo_key_gap_limit));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fallback_fee_rate"), JSIConverter<double>::toJSI(runtime, arg.fallback_fee_rate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "htlc_recv_claim_delta"), JSIConverter<double>::toJSI(runtime, arg.htlc_recv_claim_delta));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_margin"), JSIConverter<double>::toJSI(runtime, arg.vtxo_exit_margin));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "round_tx_required_confirmations"), JSIConverter<double>::toJSI(runtime, arg.round_tx_required_confirmations));
      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::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ark")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "user_agent")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "esplora")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_cookie")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_user")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitcoind_pass")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_refresh_expiry_threshold")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_key_gap_limit")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fallback_fee_rate")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_recv_claim_delta")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_exit_margin")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "round_tx_required_confirmations")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
