///
/// ExitStateDetailsResult.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 `ExitTxResult` to properly resolve imports.
namespace margelo::nitro::nitroark { struct ExitTxResult; }
// Forward declaration of `ExitBlockRefResult` to properly resolve imports.
namespace margelo::nitro::nitroark { struct ExitBlockRefResult; }

#include <string>
#include <vector>
#include <optional>
#include "ExitTxResult.hpp"
#include "ExitBlockRefResult.hpp"

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (ExitStateDetailsResult).
   */
  struct ExitStateDetailsResult final {
  public:
    std::string kind     SWIFT_PRIVATE;
    double tip_height     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> spent_inputs     SWIFT_PRIVATE;
    std::optional<std::vector<ExitTxResult>> transactions     SWIFT_PRIVATE;
    std::optional<ExitBlockRefResult> confirmed_block     SWIFT_PRIVATE;
    std::optional<double> claimable_height     SWIFT_PRIVATE;
    std::optional<ExitBlockRefResult> claimable_since     SWIFT_PRIVATE;
    std::optional<ExitBlockRefResult> last_scanned_block     SWIFT_PRIVATE;
    std::optional<std::string> claim_txid     SWIFT_PRIVATE;
    std::optional<std::string> txid     SWIFT_PRIVATE;
    std::optional<ExitBlockRefResult> block     SWIFT_PRIVATE;

  public:
    ExitStateDetailsResult() = default;
    explicit ExitStateDetailsResult(std::string kind, double tip_height, std::optional<std::vector<std::string>> spent_inputs, std::optional<std::vector<ExitTxResult>> transactions, std::optional<ExitBlockRefResult> confirmed_block, std::optional<double> claimable_height, std::optional<ExitBlockRefResult> claimable_since, std::optional<ExitBlockRefResult> last_scanned_block, std::optional<std::string> claim_txid, std::optional<std::string> txid, std::optional<ExitBlockRefResult> block): kind(kind), tip_height(tip_height), spent_inputs(spent_inputs), transactions(transactions), confirmed_block(confirmed_block), claimable_height(claimable_height), claimable_since(claimable_since), last_scanned_block(last_scanned_block), claim_txid(claim_txid), txid(txid), block(block) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ ExitStateDetailsResult <> JS ExitStateDetailsResult (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::ExitStateDetailsResult> final {
    static inline margelo::nitro::nitroark::ExitStateDetailsResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::ExitStateDetailsResult(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "kind"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tip_height"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "spent_inputs"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::nitroark::ExitTxResult>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactions"))),
        JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confirmed_block"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_height"))),
        JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_since"))),
        JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "last_scanned_block"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claim_txid"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txid"))),
        JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "block")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::ExitStateDetailsResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "kind"), JSIConverter<std::string>::toJSI(runtime, arg.kind));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "tip_height"), JSIConverter<double>::toJSI(runtime, arg.tip_height));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "spent_inputs"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.spent_inputs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "transactions"), JSIConverter<std::optional<std::vector<margelo::nitro::nitroark::ExitTxResult>>>::toJSI(runtime, arg.transactions));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "confirmed_block"), JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::toJSI(runtime, arg.confirmed_block));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "claimable_height"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.claimable_height));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "claimable_since"), JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::toJSI(runtime, arg.claimable_since));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "last_scanned_block"), JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::toJSI(runtime, arg.last_scanned_block));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "claim_txid"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.claim_txid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "txid"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.txid));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "block"), JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::toJSI(runtime, arg.block));
      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, "kind")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tip_height")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "spent_inputs")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::nitroark::ExitTxResult>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactions")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confirmed_block")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_height")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claimable_since")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "last_scanned_block")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "claim_txid")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "txid")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitroark::ExitBlockRefResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "block")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
