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

#include <string>
#include "BarkMovementSubsystem.hpp"
#include "BarkMovementDestination.hpp"
#include <vector>
#include <optional>

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (BarkMovement).
   */
  struct BarkMovement final {
  public:
    double id     SWIFT_PRIVATE;
    std::string status     SWIFT_PRIVATE;
    BarkMovementSubsystem subsystem     SWIFT_PRIVATE;
    std::string metadata_json     SWIFT_PRIVATE;
    double intended_balance_sat     SWIFT_PRIVATE;
    double effective_balance_sat     SWIFT_PRIVATE;
    double offchain_fee_sat     SWIFT_PRIVATE;
    std::vector<BarkMovementDestination> sent_to     SWIFT_PRIVATE;
    std::vector<BarkMovementDestination> received_on     SWIFT_PRIVATE;
    std::vector<std::string> input_vtxos     SWIFT_PRIVATE;
    std::vector<std::string> output_vtxos     SWIFT_PRIVATE;
    std::vector<std::string> exited_vtxos     SWIFT_PRIVATE;
    std::string created_at     SWIFT_PRIVATE;
    std::string updated_at     SWIFT_PRIVATE;
    std::optional<std::string> completed_at     SWIFT_PRIVATE;

  public:
    BarkMovement() = default;
    explicit BarkMovement(double id, std::string status, BarkMovementSubsystem subsystem, std::string metadata_json, double intended_balance_sat, double effective_balance_sat, double offchain_fee_sat, std::vector<BarkMovementDestination> sent_to, std::vector<BarkMovementDestination> received_on, std::vector<std::string> input_vtxos, std::vector<std::string> output_vtxos, std::vector<std::string> exited_vtxos, std::string created_at, std::string updated_at, std::optional<std::string> completed_at): id(id), status(status), subsystem(subsystem), metadata_json(metadata_json), intended_balance_sat(intended_balance_sat), effective_balance_sat(effective_balance_sat), offchain_fee_sat(offchain_fee_sat), sent_to(sent_to), received_on(received_on), input_vtxos(input_vtxos), output_vtxos(output_vtxos), exited_vtxos(exited_vtxos), created_at(created_at), updated_at(updated_at), completed_at(completed_at) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ BarkMovement <> JS BarkMovement (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::BarkMovement> final {
    static inline margelo::nitro::nitroark::BarkMovement fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::BarkMovement(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status"))),
        JSIConverter<margelo::nitro::nitroark::BarkMovementSubsystem>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subsystem"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata_json"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intended_balance_sat"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "effective_balance_sat"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offchain_fee_sat"))),
        JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sent_to"))),
        JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "received_on"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "input_vtxos"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "output_vtxos"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exited_vtxos"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "created_at"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "updated_at"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "completed_at")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::BarkMovement& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<double>::toJSI(runtime, arg.id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "status"), JSIConverter<std::string>::toJSI(runtime, arg.status));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subsystem"), JSIConverter<margelo::nitro::nitroark::BarkMovementSubsystem>::toJSI(runtime, arg.subsystem));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata_json"), JSIConverter<std::string>::toJSI(runtime, arg.metadata_json));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "intended_balance_sat"), JSIConverter<double>::toJSI(runtime, arg.intended_balance_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "effective_balance_sat"), JSIConverter<double>::toJSI(runtime, arg.effective_balance_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "offchain_fee_sat"), JSIConverter<double>::toJSI(runtime, arg.offchain_fee_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sent_to"), JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::toJSI(runtime, arg.sent_to));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "received_on"), JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::toJSI(runtime, arg.received_on));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "input_vtxos"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.input_vtxos));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "output_vtxos"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.output_vtxos));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "exited_vtxos"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.exited_vtxos));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "created_at"), JSIConverter<std::string>::toJSI(runtime, arg.created_at));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "updated_at"), JSIConverter<std::string>::toJSI(runtime, arg.updated_at));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "completed_at"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.completed_at));
      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, "id")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "status")))) return false;
      if (!JSIConverter<margelo::nitro::nitroark::BarkMovementSubsystem>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subsystem")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata_json")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "intended_balance_sat")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "effective_balance_sat")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offchain_fee_sat")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sent_to")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::nitroark::BarkMovementDestination>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "received_on")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "input_vtxos")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "output_vtxos")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exited_vtxos")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "created_at")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "updated_at")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "completed_at")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
