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





namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (ExitFeeEstimate).
   */
  struct ExitFeeEstimate final {
  public:
    double exit_broadcast_fee_sat     SWIFT_PRIVATE;
    double claim_fee_sat     SWIFT_PRIVATE;
    double total_fee_sat     SWIFT_PRIVATE;
    double fee_rate_sat_per_vb     SWIFT_PRIVATE;
    double txs_to_broadcast     SWIFT_PRIVATE;

  public:
    ExitFeeEstimate() = default;
    explicit ExitFeeEstimate(double exit_broadcast_fee_sat, double claim_fee_sat, double total_fee_sat, double fee_rate_sat_per_vb, double txs_to_broadcast): exit_broadcast_fee_sat(exit_broadcast_fee_sat), claim_fee_sat(claim_fee_sat), total_fee_sat(total_fee_sat), fee_rate_sat_per_vb(fee_rate_sat_per_vb), txs_to_broadcast(txs_to_broadcast) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ ExitFeeEstimate <> JS ExitFeeEstimate (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::ExitFeeEstimate> final {
    static inline margelo::nitro::nitroark::ExitFeeEstimate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::ExitFeeEstimate(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exit_broadcast_fee_sat"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claim_fee_sat"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "total_fee_sat"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fee_rate_sat_per_vb"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txs_to_broadcast")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::ExitFeeEstimate& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "exit_broadcast_fee_sat"), JSIConverter<double>::toJSI(runtime, arg.exit_broadcast_fee_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "claim_fee_sat"), JSIConverter<double>::toJSI(runtime, arg.claim_fee_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "total_fee_sat"), JSIConverter<double>::toJSI(runtime, arg.total_fee_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fee_rate_sat_per_vb"), JSIConverter<double>::toJSI(runtime, arg.fee_rate_sat_per_vb));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "txs_to_broadcast"), JSIConverter<double>::toJSI(runtime, arg.txs_to_broadcast));
      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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exit_broadcast_fee_sat")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claim_fee_sat")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "total_fee_sat")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fee_rate_sat_per_vb")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txs_to_broadcast")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
