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

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

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (ExitStatusResult).
   */
  struct ExitStatusResult final {
  public:
    std::string vtxo_id     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<ExitTransactionPackageResult> transactions     SWIFT_PRIVATE;

  public:
    ExitStatusResult() = default;
    explicit ExitStatusResult(std::string vtxo_id, std::string state, ExitStateDetailsResult state_details, std::vector<std::string> history, std::vector<ExitStateDetailsResult> history_details, std::vector<ExitTransactionPackageResult> transactions): vtxo_id(vtxo_id), state(state), state_details(state_details), history(history), history_details(history_details), transactions(transactions) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ ExitStatusResult <> JS ExitStatusResult (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::ExitStatusResult> final {
    static inline margelo::nitro::nitroark::ExitStatusResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::ExitStatusResult(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "vtxo_id"))),
        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<margelo::nitro::nitroark::ExitTransactionPackageResult>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactions")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::ExitStatusResult& 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, "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, "transactions"), JSIConverter<std::vector<margelo::nitro::nitroark::ExitTransactionPackageResult>>::toJSI(runtime, arg.transactions));
      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<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<margelo::nitro::nitroark::ExitTransactionPackageResult>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transactions")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
