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



#include <string>
#include <optional>
#include <vector>

namespace margelo::nitro::nitroark {

  /**
   * A struct which can be represented as a JavaScript object (LightningReceive).
   */
  struct LightningReceive final {
  public:
    std::string state     SWIFT_PRIVATE;
    std::optional<std::string> phase     SWIFT_PRIVATE;
    std::string payment_hash     SWIFT_PRIVATE;
    std::string payment_preimage     SWIFT_PRIVATE;
    std::string invoice     SWIFT_PRIVATE;
    std::vector<std::string> htlc_vtxo_ids     SWIFT_PRIVATE;
    std::optional<double> movement_id     SWIFT_PRIVATE;
    std::optional<double> amount_sat     SWIFT_PRIVATE;
    std::optional<double> settled_at     SWIFT_PRIVATE;

  public:
    LightningReceive() = default;
    explicit LightningReceive(std::string state, std::optional<std::string> phase, std::string payment_hash, std::string payment_preimage, std::string invoice, std::vector<std::string> htlc_vtxo_ids, std::optional<double> movement_id, std::optional<double> amount_sat, std::optional<double> settled_at): state(state), phase(phase), payment_hash(payment_hash), payment_preimage(payment_preimage), invoice(invoice), htlc_vtxo_ids(htlc_vtxo_ids), movement_id(movement_id), amount_sat(amount_sat), settled_at(settled_at) {}

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

} // namespace margelo::nitro::nitroark

namespace margelo::nitro {

  // C++ LightningReceive <> JS LightningReceive (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroark::LightningReceive> final {
    static inline margelo::nitro::nitroark::LightningReceive fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroark::LightningReceive(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phase"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_hash"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_preimage"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invoice"))),
        JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_vtxo_ids"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "movement_id"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "settled_at")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroark::LightningReceive& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "state"), JSIConverter<std::string>::toJSI(runtime, arg.state));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "phase"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.phase));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "payment_hash"), JSIConverter<std::string>::toJSI(runtime, arg.payment_hash));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "payment_preimage"), JSIConverter<std::string>::toJSI(runtime, arg.payment_preimage));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "invoice"), JSIConverter<std::string>::toJSI(runtime, arg.invoice));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "htlc_vtxo_ids"), JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.htlc_vtxo_ids));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "movement_id"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.movement_id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "amount_sat"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.amount_sat));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "settled_at"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.settled_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<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "state")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "phase")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_hash")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_preimage")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "invoice")))) return false;
      if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "htlc_vtxo_ids")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "movement_id")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount_sat")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "settled_at")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
