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

// Forward declaration of `ExitStateDetailsResult` to properly resolve imports.
namespace margelo::nitro::nitroark { struct ExitStateDetailsResult; }

#include <string>
#include "ExitStateDetailsResult.hpp"
#include <vector>

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (ExitVtxoResult).
   */
  struct ExitVtxoResult final {
  public:
    std::string vtxo_id     SWIFT_PRIVATE;
    double amount_sat     SWIFT_PRIVATE;
    std::string state     SWIFT_PRIVATE;
    ExitStateDetailsResult state_details     SWIFT_PRIVATE;
    std::vector<std::string> history     SWIFT_PRIVATE;
    std::vector<ExitStateDetailsResult> history_details     SWIFT_PRIVATE;
    std::vector<std::string> txids     SWIFT_PRIVATE;
    bool is_claimable     SWIFT_PRIVATE;
    bool is_initialized     SWIFT_PRIVATE;

  public:
    ExitVtxoResult() = default;
    explicit ExitVtxoResult(std::string vtxo_id, double amount_sat, std::string state, ExitStateDetailsResult state_details, std::vector<std::string> history, std::vector<ExitStateDetailsResult> history_details, std::vector<std::string> txids, bool is_claimable, bool is_initialized): vtxo_id(vtxo_id), amount_sat(amount_sat), state(state), state_details(state_details), history(history), history_details(history_details), txids(txids), is_claimable(is_claimable), is_initialized(is_initialized) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ ExitVtxoResult <> JS ExitVtxoResult (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::ExitVtxoResult> final {
    static inline margelo::nitro::nitroark::ExitVtxoResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::ExitVtxoResult(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state"))),
        JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state_details"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history"))),
        JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history_details"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txids"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_claimable"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_initialized")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::ExitVtxoResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id"), JSIConverter<std::string>::toJSI(runtime, arg.vtxo_id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"), JSIConverter<double>::toJSI(runtime, arg.amount_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "state"), JSIConverter<std::string>::toJSI(runtime, arg.state));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "state_details"), JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::toJSI(runtime, arg.state_details));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "history"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.history));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "history_details"), JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::toJSI(runtime, arg.history_details));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "txids"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.txids));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "is_claimable"), JSIConverter<bool>::toJSI(runtime, arg.is_claimable));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "is_initialized"), JSIConverter<bool>::toJSI(runtime, arg.is_initialized));
      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, "vtxo_id")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state")))) return false;
      if (!JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state_details")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::nitroark::ExitStateDetailsResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "history_details")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txids")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_claimable")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_initialized")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
