#pragma once
#include <algorithm>
#include <array>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <iterator>
#include <new>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#if __cplusplus >= 201703L
#include <string_view>
#endif
#if __cplusplus >= 202002L
#include <ranges>
#endif

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
#endif // __clang__

namespace rust {
inline namespace cxxbridge1 {
// #include "rust/cxx.h"

#ifndef CXXBRIDGE1_PANIC
#define CXXBRIDGE1_PANIC
template <typename Exception>
void panic [[noreturn]] (const char *msg);
#endif // CXXBRIDGE1_PANIC

struct unsafe_bitcopy_t;

namespace {
template <typename T>
class impl;
} // namespace

template <typename T>
::std::size_t size_of();
template <typename T>
::std::size_t align_of();

#ifndef CXXBRIDGE1_RUST_STRING
#define CXXBRIDGE1_RUST_STRING
class String final {
public:
  String() noexcept;
  String(const String &) noexcept;
  String(String &&) noexcept;
  ~String() noexcept;

  String(const std::string &);
  String(const char *);
  String(const char *, std::size_t);
  String(const char16_t *);
  String(const char16_t *, std::size_t);
#ifdef __cpp_char8_t
  String(const char8_t *s);
  String(const char8_t *s, std::size_t len);
#endif

  static String lossy(const std::string &) noexcept;
  static String lossy(const char *) noexcept;
  static String lossy(const char *, std::size_t) noexcept;
  static String lossy(const char16_t *) noexcept;
  static String lossy(const char16_t *, std::size_t) noexcept;

  String &operator=(const String &) & noexcept;
  String &operator=(String &&) & noexcept;

  explicit operator std::string() const;

  const char *data() const noexcept;
  std::size_t size() const noexcept;
  std::size_t length() const noexcept;
  bool empty() const noexcept;

  const char *c_str() noexcept;

  std::size_t capacity() const noexcept;
  void reserve(size_t new_cap) noexcept;

  using iterator = char *;
  iterator begin() noexcept;
  iterator end() noexcept;

  using const_iterator = const char *;
  const_iterator begin() const noexcept;
  const_iterator end() const noexcept;
  const_iterator cbegin() const noexcept;
  const_iterator cend() const noexcept;

  bool operator==(const String &) const noexcept;
  bool operator!=(const String &) const noexcept;
  bool operator<(const String &) const noexcept;
  bool operator<=(const String &) const noexcept;
  bool operator>(const String &) const noexcept;
  bool operator>=(const String &) const noexcept;

  void swap(String &) noexcept;

  String(unsafe_bitcopy_t, const String &) noexcept;

private:
  struct lossy_t;
  String(lossy_t, const char *, std::size_t) noexcept;
  String(lossy_t, const char16_t *, std::size_t) noexcept;
  friend void swap(String &lhs, String &rhs) noexcept { lhs.swap(rhs); }

  std::array<std::uintptr_t, 3> repr;
};
#endif // CXXBRIDGE1_RUST_STRING

#ifndef CXXBRIDGE1_RUST_STR
#define CXXBRIDGE1_RUST_STR
class Str final {
public:
  Str() noexcept;
  Str(const String &) noexcept;
  Str(const std::string &);
  Str(const char *);
  Str(const char *, std::size_t);

  Str &operator=(const Str &) & noexcept = default;

  explicit operator std::string() const;
#if __cplusplus >= 201703L
  explicit operator std::string_view() const;
#endif

  const char *data() const noexcept;
  std::size_t size() const noexcept;
  std::size_t length() const noexcept;
  bool empty() const noexcept;

  Str(const Str &) noexcept = default;
  ~Str() noexcept = default;

  using iterator = const char *;
  using const_iterator = const char *;
  const_iterator begin() const noexcept;
  const_iterator end() const noexcept;
  const_iterator cbegin() const noexcept;
  const_iterator cend() const noexcept;

  bool operator==(const Str &) const noexcept;
  bool operator!=(const Str &) const noexcept;
  bool operator<(const Str &) const noexcept;
  bool operator<=(const Str &) const noexcept;
  bool operator>(const Str &) const noexcept;
  bool operator>=(const Str &) const noexcept;

  void swap(Str &) noexcept;

private:
  class uninit;
  Str(uninit) noexcept;
  friend impl<Str>;

  std::array<std::uintptr_t, 2> repr;
};
#endif // CXXBRIDGE1_RUST_STR

#ifndef CXXBRIDGE1_RUST_SLICE
#define CXXBRIDGE1_RUST_SLICE
namespace detail {
template <bool>
struct copy_assignable_if {};

template <>
struct copy_assignable_if<false> {
  copy_assignable_if() noexcept = default;
  copy_assignable_if(const copy_assignable_if &) noexcept = default;
  copy_assignable_if &operator=(const copy_assignable_if &) & noexcept = delete;
  copy_assignable_if &operator=(copy_assignable_if &&) & noexcept = default;
};
} // namespace detail

template <typename T>
class Slice final
    : private detail::copy_assignable_if<std::is_const<T>::value> {
public:
  using value_type = T;

  Slice() noexcept;
  Slice(T *, std::size_t count) noexcept;

  template <typename C>
  explicit Slice(C &c) : Slice(c.data(), c.size()) {}

  Slice &operator=(const Slice<T> &) & noexcept = default;
  Slice &operator=(Slice<T> &&) & noexcept = default;

  T *data() const noexcept;
  std::size_t size() const noexcept;
  std::size_t length() const noexcept;
  bool empty() const noexcept;

  T &operator[](std::size_t n) const noexcept;
  T &at(std::size_t n) const;
  T &front() const noexcept;
  T &back() const noexcept;

  Slice(const Slice<T> &) noexcept = default;
  ~Slice() noexcept = default;

  class iterator;
  iterator begin() const noexcept;
  iterator end() const noexcept;

  void swap(Slice &) noexcept;

private:
  class uninit;
  Slice(uninit) noexcept;
  friend impl<Slice>;
  friend void sliceInit(void *, const void *, std::size_t) noexcept;
  friend void *slicePtr(const void *) noexcept;
  friend std::size_t sliceLen(const void *) noexcept;

  std::array<std::uintptr_t, 2> repr;
};

#ifdef __cpp_deduction_guides
template <typename C>
explicit Slice(C &c)
    -> Slice<std::remove_reference_t<decltype(*std::declval<C>().data())>>;
#endif // __cpp_deduction_guides

template <typename T>
class Slice<T>::iterator final {
public:
#if __cplusplus >= 202002L
  using iterator_category = std::contiguous_iterator_tag;
#else
  using iterator_category = std::random_access_iterator_tag;
#endif
  using value_type = T;
  using difference_type = std::ptrdiff_t;
  using pointer = typename std::add_pointer<T>::type;
  using reference = typename std::add_lvalue_reference<T>::type;

  reference operator*() const noexcept;
  pointer operator->() const noexcept;
  reference operator[](difference_type) const noexcept;

  iterator &operator++() noexcept;
  iterator operator++(int) noexcept;
  iterator &operator--() noexcept;
  iterator operator--(int) noexcept;

  iterator &operator+=(difference_type) noexcept;
  iterator &operator-=(difference_type) noexcept;
  iterator operator+(difference_type) const noexcept;
  friend inline iterator operator+(difference_type lhs, iterator rhs) noexcept {
    return rhs + lhs;
  }
  iterator operator-(difference_type) const noexcept;
  difference_type operator-(const iterator &) const noexcept;

  bool operator==(const iterator &) const noexcept;
  bool operator!=(const iterator &) const noexcept;
  bool operator<(const iterator &) const noexcept;
  bool operator<=(const iterator &) const noexcept;
  bool operator>(const iterator &) const noexcept;
  bool operator>=(const iterator &) const noexcept;

private:
  friend class Slice;
  void *pos;
  std::size_t stride;
};

#if __cplusplus >= 202002L
static_assert(std::ranges::contiguous_range<rust::Slice<const uint8_t>>);
static_assert(std::contiguous_iterator<rust::Slice<const uint8_t>::iterator>);
#endif

template <typename T>
Slice<T>::Slice() noexcept {
  sliceInit(this, reinterpret_cast<void *>(align_of<T>()), 0);
}

template <typename T>
Slice<T>::Slice(T *s, std::size_t count) noexcept {
  assert(s != nullptr || count == 0);
  sliceInit(this,
            s == nullptr && count == 0
                ? reinterpret_cast<void *>(align_of<T>())
                : const_cast<typename std::remove_const<T>::type *>(s),
            count);
}

template <typename T>
T *Slice<T>::data() const noexcept {
  return reinterpret_cast<T *>(slicePtr(this));
}

template <typename T>
std::size_t Slice<T>::size() const noexcept {
  return sliceLen(this);
}

template <typename T>
std::size_t Slice<T>::length() const noexcept {
  return this->size();
}

template <typename T>
bool Slice<T>::empty() const noexcept {
  return this->size() == 0;
}

template <typename T>
T &Slice<T>::operator[](std::size_t n) const noexcept {
  assert(n < this->size());
  auto ptr = static_cast<char *>(slicePtr(this)) + size_of<T>() * n;
  return *reinterpret_cast<T *>(ptr);
}

template <typename T>
T &Slice<T>::at(std::size_t n) const {
  if (n >= this->size()) {
    panic<std::out_of_range>("rust::Slice index out of range");
  }
  return (*this)[n];
}

template <typename T>
T &Slice<T>::front() const noexcept {
  assert(!this->empty());
  return (*this)[0];
}

template <typename T>
T &Slice<T>::back() const noexcept {
  assert(!this->empty());
  return (*this)[this->size() - 1];
}

template <typename T>
typename Slice<T>::iterator::reference
Slice<T>::iterator::operator*() const noexcept {
  return *static_cast<T *>(this->pos);
}

template <typename T>
typename Slice<T>::iterator::pointer
Slice<T>::iterator::operator->() const noexcept {
  return static_cast<T *>(this->pos);
}

template <typename T>
typename Slice<T>::iterator::reference Slice<T>::iterator::operator[](
    typename Slice<T>::iterator::difference_type n) const noexcept {
  auto ptr = static_cast<char *>(this->pos) + this->stride * n;
  return *reinterpret_cast<T *>(ptr);
}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator++() noexcept {
  this->pos = static_cast<char *>(this->pos) + this->stride;
  return *this;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator++(int) noexcept {
  auto ret = iterator(*this);
  this->pos = static_cast<char *>(this->pos) + this->stride;
  return ret;
}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator--() noexcept {
  this->pos = static_cast<char *>(this->pos) - this->stride;
  return *this;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator--(int) noexcept {
  auto ret = iterator(*this);
  this->pos = static_cast<char *>(this->pos) - this->stride;
  return ret;
}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator+=(
    typename Slice<T>::iterator::difference_type n) noexcept {
  this->pos = static_cast<char *>(this->pos) + this->stride * n;
  return *this;
}

template <typename T>
typename Slice<T>::iterator &Slice<T>::iterator::operator-=(
    typename Slice<T>::iterator::difference_type n) noexcept {
  this->pos = static_cast<char *>(this->pos) - this->stride * n;
  return *this;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator+(
    typename Slice<T>::iterator::difference_type n) const noexcept {
  auto ret = iterator(*this);
  ret.pos = static_cast<char *>(this->pos) + this->stride * n;
  return ret;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::iterator::operator-(
    typename Slice<T>::iterator::difference_type n) const noexcept {
  auto ret = iterator(*this);
  ret.pos = static_cast<char *>(this->pos) - this->stride * n;
  return ret;
}

template <typename T>
typename Slice<T>::iterator::difference_type
Slice<T>::iterator::operator-(const iterator &other) const noexcept {
  auto diff = std::distance(static_cast<char *>(other.pos),
                            static_cast<char *>(this->pos));
  return diff / static_cast<typename Slice<T>::iterator::difference_type>(
                    this->stride);
}

template <typename T>
bool Slice<T>::iterator::operator==(const iterator &other) const noexcept {
  return this->pos == other.pos;
}

template <typename T>
bool Slice<T>::iterator::operator!=(const iterator &other) const noexcept {
  return this->pos != other.pos;
}

template <typename T>
bool Slice<T>::iterator::operator<(const iterator &other) const noexcept {
  return this->pos < other.pos;
}

template <typename T>
bool Slice<T>::iterator::operator<=(const iterator &other) const noexcept {
  return this->pos <= other.pos;
}

template <typename T>
bool Slice<T>::iterator::operator>(const iterator &other) const noexcept {
  return this->pos > other.pos;
}

template <typename T>
bool Slice<T>::iterator::operator>=(const iterator &other) const noexcept {
  return this->pos >= other.pos;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::begin() const noexcept {
  iterator it;
  it.pos = slicePtr(this);
  it.stride = size_of<T>();
  return it;
}

template <typename T>
typename Slice<T>::iterator Slice<T>::end() const noexcept {
  iterator it = this->begin();
  it.pos = static_cast<char *>(it.pos) + it.stride * this->size();
  return it;
}

template <typename T>
void Slice<T>::swap(Slice &rhs) noexcept {
  std::swap(*this, rhs);
}
#endif // CXXBRIDGE1_RUST_SLICE

#ifndef CXXBRIDGE1_RUST_BOX
#define CXXBRIDGE1_RUST_BOX
template <typename T>
class Box final {
public:
  using element_type = T;
  using const_pointer =
      typename std::add_pointer<typename std::add_const<T>::type>::type;
  using pointer = typename std::add_pointer<T>::type;

  Box() = delete;
  Box(Box &&) noexcept;
  ~Box() noexcept;

  explicit Box(const T &);
  explicit Box(T &&);

  Box &operator=(Box &&) & noexcept;

  const T *operator->() const noexcept;
  const T &operator*() const noexcept;
  T *operator->() noexcept;
  T &operator*() noexcept;

  template <typename... Fields>
  static Box in_place(Fields &&...);

  void swap(Box &) noexcept;

  static Box from_raw(T *) noexcept;

  T *into_raw() noexcept;

  /* Deprecated */ using value_type = element_type;

private:
  class uninit;
  class allocation;
  Box(uninit) noexcept;
  void drop() noexcept;

  friend void swap(Box &lhs, Box &rhs) noexcept { lhs.swap(rhs); }

  T *ptr;
};

template <typename T>
class Box<T>::uninit {};

template <typename T>
class Box<T>::allocation {
  static T *alloc() noexcept;
  static void dealloc(T *) noexcept;

public:
  allocation() noexcept : ptr(alloc()) {}
  ~allocation() noexcept {
    if (this->ptr) {
      dealloc(this->ptr);
    }
  }
  T *ptr;
};

template <typename T>
Box<T>::Box(Box &&other) noexcept : ptr(other.ptr) {
  other.ptr = nullptr;
}

template <typename T>
Box<T>::Box(const T &val) {
  allocation alloc;
  ::new (alloc.ptr) T(val);
  this->ptr = alloc.ptr;
  alloc.ptr = nullptr;
}

template <typename T>
Box<T>::Box(T &&val) {
  allocation alloc;
  ::new (alloc.ptr) T(std::move(val));
  this->ptr = alloc.ptr;
  alloc.ptr = nullptr;
}

template <typename T>
Box<T>::~Box() noexcept {
  if (this->ptr) {
    this->drop();
  }
}

template <typename T>
Box<T> &Box<T>::operator=(Box &&other) & noexcept {
  if (this->ptr) {
    this->drop();
  }
  this->ptr = other.ptr;
  other.ptr = nullptr;
  return *this;
}

template <typename T>
const T *Box<T>::operator->() const noexcept {
  return this->ptr;
}

template <typename T>
const T &Box<T>::operator*() const noexcept {
  return *this->ptr;
}

template <typename T>
T *Box<T>::operator->() noexcept {
  return this->ptr;
}

template <typename T>
T &Box<T>::operator*() noexcept {
  return *this->ptr;
}

template <typename T>
template <typename... Fields>
Box<T> Box<T>::in_place(Fields &&...fields) {
  allocation alloc;
  auto ptr = alloc.ptr;
  ::new (ptr) T{std::forward<Fields>(fields)...};
  alloc.ptr = nullptr;
  return from_raw(ptr);
}

template <typename T>
void Box<T>::swap(Box &rhs) noexcept {
  using std::swap;
  swap(this->ptr, rhs.ptr);
}

template <typename T>
Box<T> Box<T>::from_raw(T *raw) noexcept {
  Box box = uninit{};
  box.ptr = raw;
  return box;
}

template <typename T>
T *Box<T>::into_raw() noexcept {
  T *raw = this->ptr;
  this->ptr = nullptr;
  return raw;
}

template <typename T>
Box<T>::Box(uninit) noexcept {}
#endif // CXXBRIDGE1_RUST_BOX

#ifndef CXXBRIDGE1_RUST_BITCOPY_T
#define CXXBRIDGE1_RUST_BITCOPY_T
struct unsafe_bitcopy_t final {
  explicit unsafe_bitcopy_t() = default;
};
#endif // CXXBRIDGE1_RUST_BITCOPY_T

#ifndef CXXBRIDGE1_RUST_VEC
#define CXXBRIDGE1_RUST_VEC
template <typename T>
class Vec final {
public:
  using value_type = T;

  Vec() noexcept;
  Vec(std::initializer_list<T>);
  Vec(const Vec &);
  Vec(Vec &&) noexcept;
  ~Vec() noexcept;

  Vec &operator=(Vec &&) & noexcept;
  Vec &operator=(const Vec &) &;

  std::size_t size() const noexcept;
  bool empty() const noexcept;
  const T *data() const noexcept;
  T *data() noexcept;
  std::size_t capacity() const noexcept;

  const T &operator[](std::size_t n) const noexcept;
  const T &at(std::size_t n) const;
  const T &front() const noexcept;
  const T &back() const noexcept;

  T &operator[](std::size_t n) noexcept;
  T &at(std::size_t n);
  T &front() noexcept;
  T &back() noexcept;

  void reserve(std::size_t new_cap);
  void push_back(const T &value);
  void push_back(T &&value);
  template <typename... Args>
  void emplace_back(Args &&...args);
  void truncate(std::size_t len);
  void clear();

  using iterator = typename Slice<T>::iterator;
  iterator begin() noexcept;
  iterator end() noexcept;

  using const_iterator = typename Slice<const T>::iterator;
  const_iterator begin() const noexcept;
  const_iterator end() const noexcept;
  const_iterator cbegin() const noexcept;
  const_iterator cend() const noexcept;

  void swap(Vec &) noexcept;

  Vec(unsafe_bitcopy_t, const Vec &) noexcept;

private:
  void reserve_total(std::size_t new_cap) noexcept;
  void set_len(std::size_t len) noexcept;
  void drop() noexcept;

  friend void swap(Vec &lhs, Vec &rhs) noexcept { lhs.swap(rhs); }

  std::array<std::uintptr_t, 3> repr;
};

template <typename T>
Vec<T>::Vec(std::initializer_list<T> init) : Vec{} {
  this->reserve_total(init.size());
  std::move(init.begin(), init.end(), std::back_inserter(*this));
}

template <typename T>
Vec<T>::Vec(const Vec &other) : Vec() {
  this->reserve_total(other.size());
  std::copy(other.begin(), other.end(), std::back_inserter(*this));
}

template <typename T>
Vec<T>::Vec(Vec &&other) noexcept : repr(other.repr) {
  new (&other) Vec();
}

template <typename T>
Vec<T>::~Vec() noexcept {
  this->drop();
}

template <typename T>
Vec<T> &Vec<T>::operator=(Vec &&other) & noexcept {
  this->drop();
  this->repr = other.repr;
  new (&other) Vec();
  return *this;
}

template <typename T>
Vec<T> &Vec<T>::operator=(const Vec &other) & {
  if (this != &other) {
    this->drop();
    new (this) Vec(other);
  }
  return *this;
}

template <typename T>
bool Vec<T>::empty() const noexcept {
  return this->size() == 0;
}

template <typename T>
T *Vec<T>::data() noexcept {
  return const_cast<T *>(const_cast<const Vec<T> *>(this)->data());
}

template <typename T>
const T &Vec<T>::operator[](std::size_t n) const noexcept {
  assert(n < this->size());
  auto data = reinterpret_cast<const char *>(this->data());
  return *reinterpret_cast<const T *>(data + n * size_of<T>());
}

template <typename T>
const T &Vec<T>::at(std::size_t n) const {
  if (n >= this->size()) {
    panic<std::out_of_range>("rust::Vec index out of range");
  }
  return (*this)[n];
}

template <typename T>
const T &Vec<T>::front() const noexcept {
  assert(!this->empty());
  return (*this)[0];
}

template <typename T>
const T &Vec<T>::back() const noexcept {
  assert(!this->empty());
  return (*this)[this->size() - 1];
}

template <typename T>
T &Vec<T>::operator[](std::size_t n) noexcept {
  assert(n < this->size());
  auto data = reinterpret_cast<char *>(this->data());
  return *reinterpret_cast<T *>(data + n * size_of<T>());
}

template <typename T>
T &Vec<T>::at(std::size_t n) {
  if (n >= this->size()) {
    panic<std::out_of_range>("rust::Vec index out of range");
  }
  return (*this)[n];
}

template <typename T>
T &Vec<T>::front() noexcept {
  assert(!this->empty());
  return (*this)[0];
}

template <typename T>
T &Vec<T>::back() noexcept {
  assert(!this->empty());
  return (*this)[this->size() - 1];
}

template <typename T>
void Vec<T>::reserve(std::size_t new_cap) {
  this->reserve_total(new_cap);
}

template <typename T>
void Vec<T>::push_back(const T &value) {
  this->emplace_back(value);
}

template <typename T>
void Vec<T>::push_back(T &&value) {
  this->emplace_back(std::move(value));
}

template <typename T>
template <typename... Args>
void Vec<T>::emplace_back(Args &&...args) {
  auto size = this->size();
  this->reserve_total(size + 1);
  ::new (reinterpret_cast<T *>(reinterpret_cast<char *>(this->data()) +
                               size * size_of<T>()))
      T(std::forward<Args>(args)...);
  this->set_len(size + 1);
}

template <typename T>
void Vec<T>::clear() {
  this->truncate(0);
}

template <typename T>
typename Vec<T>::iterator Vec<T>::begin() noexcept {
  return Slice<T>(this->data(), this->size()).begin();
}

template <typename T>
typename Vec<T>::iterator Vec<T>::end() noexcept {
  return Slice<T>(this->data(), this->size()).end();
}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::begin() const noexcept {
  return this->cbegin();
}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::end() const noexcept {
  return this->cend();
}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::cbegin() const noexcept {
  return Slice<const T>(this->data(), this->size()).begin();
}

template <typename T>
typename Vec<T>::const_iterator Vec<T>::cend() const noexcept {
  return Slice<const T>(this->data(), this->size()).end();
}

template <typename T>
void Vec<T>::swap(Vec &rhs) noexcept {
  using std::swap;
  swap(this->repr, rhs.repr);
}

template <typename T>
Vec<T>::Vec(unsafe_bitcopy_t, const Vec &bits) noexcept : repr(bits.repr) {}
#endif // CXXBRIDGE1_RUST_VEC

#ifndef CXXBRIDGE1_RUST_OPAQUE
#define CXXBRIDGE1_RUST_OPAQUE
class Opaque {
public:
  Opaque() = delete;
  Opaque(const Opaque &) = delete;
  ~Opaque() = delete;
};
#endif // CXXBRIDGE1_RUST_OPAQUE

#ifndef CXXBRIDGE1_IS_COMPLETE
#define CXXBRIDGE1_IS_COMPLETE
namespace detail {
namespace {
template <typename T, typename = std::size_t>
struct is_complete : std::false_type {};
template <typename T>
struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
} // namespace
} // namespace detail
#endif // CXXBRIDGE1_IS_COMPLETE

#ifndef CXXBRIDGE1_LAYOUT
#define CXXBRIDGE1_LAYOUT
class layout {
  template <typename T>
  friend std::size_t size_of();
  template <typename T>
  friend std::size_t align_of();
  template <typename T>
  static typename std::enable_if<std::is_base_of<Opaque, T>::value,
                                 std::size_t>::type
  do_size_of() {
    return T::layout::size();
  }
  template <typename T>
  static typename std::enable_if<!std::is_base_of<Opaque, T>::value,
                                 std::size_t>::type
  do_size_of() {
    return sizeof(T);
  }
  template <typename T>
  static
      typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
      size_of() {
    return do_size_of<T>();
  }
  template <typename T>
  static typename std::enable_if<std::is_base_of<Opaque, T>::value,
                                 std::size_t>::type
  do_align_of() {
    return T::layout::align();
  }
  template <typename T>
  static typename std::enable_if<!std::is_base_of<Opaque, T>::value,
                                 std::size_t>::type
  do_align_of() {
    return alignof(T);
  }
  template <typename T>
  static
      typename std::enable_if<detail::is_complete<T>::value, std::size_t>::type
      align_of() {
    return do_align_of<T>();
  }
};

template <typename T>
std::size_t size_of() {
  return layout::size_of<T>();
}

template <typename T>
std::size_t align_of() {
  return layout::align_of<T>();
}
#endif // CXXBRIDGE1_LAYOUT
} // namespace cxxbridge1
} // namespace rust

#if __cplusplus >= 201402L
#define CXX_DEFAULT_VALUE(value) = value
#else
#define CXX_DEFAULT_VALUE(value)
#endif

namespace bark_cxx {
  struct BarkVtxo;
  struct BoardResult;
  struct RecoveryGroup;
  struct RecoveryReport;
  struct RestoreWalletResult;
  struct NewAddressResult;
  struct Bolt11Invoice;
  struct LightningPaymentResult;
  struct ArkoorPaymentResult;
  struct OffboardResult;
  struct PaymentRequestOption;
  struct ParsedPaymentRequest;
  struct BarkFeeEstimate;
  struct ExitFeeEstimate;
  struct BarkFeeRates;
  struct OnchainPaymentResult;
  struct OnchainTransactionInfo;
  struct ExitBlockRefResult;
  struct ExitTxOriginResult;
  struct ExitTxStatusResult;
  struct ExitTxResult;
  struct ExitStateDetailsResult;
  struct ExitProgressStatusResult;
  struct ExitVtxoResult;
  struct ExitTransactionPackageResult;
  struct ExitStatusResult;
  struct CxxArkInfo;
  struct WalletDebugInfo;
  struct LightningSendOptions;
  struct ConfigOpts;
  struct CreateOpts;
  struct SendManyOutput;
  enum class RefreshModeType : ::std::uint8_t;
  struct LightningReceive;
  struct OffchainBalance;
  struct OnChainBalance;
  struct KeyPairResult;
  struct MailboxAuthorizationResult;
  struct NotificationEvent;
  struct NotificationPollResult;
  struct WalletSnapshotInfo;
  struct WalletSnapshotExpectation;
  struct StateChangeEvent;
  struct StateChangePollResult;
  struct BarkMovementDestination;
  struct BarkMovement;
  struct PendingRoundStatus;
  struct DelegatedRoundState;
  struct NotificationSubscription;
  struct StateChangeSubscription;
}

namespace bark_cxx {
#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BarkVtxo
#define CXXBRIDGE1_STRUCT_bark_cxx$BarkVtxo
struct BarkVtxo final {
  ::rust::String id;
  ::std::uint64_t amount CXX_DEFAULT_VALUE(0);
  ::std::uint32_t expiry_height CXX_DEFAULT_VALUE(0);
  ::rust::String server_pubkey;
  ::std::uint16_t exit_delta CXX_DEFAULT_VALUE(0);
  ::rust::String anchor_point;
  ::rust::String point;
  ::rust::String state;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BarkVtxo

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BoardResult
#define CXXBRIDGE1_STRUCT_bark_cxx$BoardResult
struct BoardResult final {
  ::rust::Vec<::rust::String> vtxos;
  ::rust::String funding_txid;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BoardResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$RecoveryGroup
#define CXXBRIDGE1_STRUCT_bark_cxx$RecoveryGroup
struct RecoveryGroup final {
  ::rust::Vec<::rust::String> vtxo_ids;
  ::std::uint64_t known_amount_sat CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$RecoveryGroup

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$RecoveryReport
#define CXXBRIDGE1_STRUCT_bark_cxx$RecoveryReport
struct RecoveryReport final {
  bool is_complete CXX_DEFAULT_VALUE(false);
  ::bark_cxx::RecoveryGroup recovered;
  ::bark_cxx::RecoveryGroup skipped;
  ::bark_cxx::RecoveryGroup exited;
  ::bark_cxx::RecoveryGroup failed;
  ::bark_cxx::RecoveryGroup foreign;
  ::bark_cxx::RecoveryGroup not_found;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$RecoveryReport

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$RestoreWalletResult
#define CXXBRIDGE1_STRUCT_bark_cxx$RestoreWalletResult
struct RestoreWalletResult final {
  ::rust::String status;
  bool has_report CXX_DEFAULT_VALUE(false);
  ::bark_cxx::RecoveryReport report;
  ::rust::String error;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$RestoreWalletResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$NewAddressResult
#define CXXBRIDGE1_STRUCT_bark_cxx$NewAddressResult
struct NewAddressResult final {
  ::rust::String user_pubkey;
  ::rust::String ark_id;
  ::rust::String address;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$NewAddressResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$Bolt11Invoice
#define CXXBRIDGE1_STRUCT_bark_cxx$Bolt11Invoice
struct Bolt11Invoice final {
  ::rust::String bolt11_invoice;
  ::rust::String payment_secret;
  ::rust::String payment_hash;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$Bolt11Invoice

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$LightningPaymentResult
#define CXXBRIDGE1_STRUCT_bark_cxx$LightningPaymentResult
struct LightningPaymentResult final {
  ::rust::String state;
  ::rust::String invoice;
  ::rust::String payment_hash;
  bool has_amount CXX_DEFAULT_VALUE(false);
  ::std::uint64_t amount CXX_DEFAULT_VALUE(0);
  ::rust::Vec<::bark_cxx::BarkVtxo> htlc_vtxos;
  bool has_movement_id CXX_DEFAULT_VALUE(false);
  ::std::uint32_t movement_id CXX_DEFAULT_VALUE(0);
  ::rust::String preimage;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$LightningPaymentResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ArkoorPaymentResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ArkoorPaymentResult
struct ArkoorPaymentResult final {
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
  ::rust::String destination_pubkey;
  ::std::uint32_t movement_id CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ArkoorPaymentResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OffboardResult
#define CXXBRIDGE1_STRUCT_bark_cxx$OffboardResult
struct OffboardResult final {
  ::rust::String txid;
  ::std::uint32_t movement_id CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OffboardResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$PaymentRequestOption
#define CXXBRIDGE1_STRUCT_bark_cxx$PaymentRequestOption
struct PaymentRequestOption final {
  ::rust::String method_type;
  ::rust::String value;
  ::rust::Vec<::rust::String> errors;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$PaymentRequestOption

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ParsedPaymentRequest
#define CXXBRIDGE1_STRUCT_bark_cxx$ParsedPaymentRequest
struct ParsedPaymentRequest final {
  bool has_amount CXX_DEFAULT_VALUE(false);
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
  ::rust::String label;
  ::rust::String message;
  ::rust::Vec<::bark_cxx::PaymentRequestOption> options;
  bool has_default_option CXX_DEFAULT_VALUE(false);
  ::std::uint32_t default_option_index CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ParsedPaymentRequest

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeEstimate
#define CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeEstimate
struct BarkFeeEstimate final {
  ::std::uint64_t gross_amount_sat CXX_DEFAULT_VALUE(0);
  ::std::uint64_t fee_sat CXX_DEFAULT_VALUE(0);
  ::std::uint64_t net_amount_sat CXX_DEFAULT_VALUE(0);
  ::rust::Vec<::rust::String> vtxos_spent;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeEstimate

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitFeeEstimate
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitFeeEstimate
struct ExitFeeEstimate final {
  ::std::uint64_t exit_broadcast_fee_sat CXX_DEFAULT_VALUE(0);
  ::std::uint64_t claim_fee_sat CXX_DEFAULT_VALUE(0);
  ::std::uint64_t total_fee_sat CXX_DEFAULT_VALUE(0);
  double fee_rate_sat_per_vb CXX_DEFAULT_VALUE(0);
  ::std::uint64_t txs_to_broadcast CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitFeeEstimate

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeRates
#define CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeRates
struct BarkFeeRates final {
  double fast CXX_DEFAULT_VALUE(0);
  double regular CXX_DEFAULT_VALUE(0);
  double slow CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BarkFeeRates

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult
#define CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult
struct OnchainPaymentResult final {
  ::rust::String txid;
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
  ::rust::String destination_address;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OnchainPaymentResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OnchainTransactionInfo
#define CXXBRIDGE1_STRUCT_bark_cxx$OnchainTransactionInfo
struct OnchainTransactionInfo final {
  ::rust::String txid;
  ::rust::String tx_hex;
  bool has_onchain_fee CXX_DEFAULT_VALUE(false);
  ::std::uint64_t onchain_fee_sat CXX_DEFAULT_VALUE(0);
  ::std::int64_t balance_change_sat CXX_DEFAULT_VALUE(0);
  bool has_confirmation CXX_DEFAULT_VALUE(false);
  ::std::uint32_t confirmation_height CXX_DEFAULT_VALUE(0);
  ::rust::String confirmation_hash;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OnchainTransactionInfo

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitBlockRefResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitBlockRefResult
struct ExitBlockRefResult final {
  ::std::uint32_t height CXX_DEFAULT_VALUE(0);
  ::rust::String hash;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitBlockRefResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitTxOriginResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitTxOriginResult
struct ExitTxOriginResult final {
  ::rust::String kind;
  bool has_confirmed_in CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult confirmed_in;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitTxOriginResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitTxStatusResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitTxStatusResult
struct ExitTxStatusResult final {
  ::rust::String kind;
  ::rust::Vec<::rust::String> txids;
  ::rust::String child_txid;
  bool has_origin CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitTxOriginResult origin;
  bool has_block CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult block;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitTxStatusResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitTxResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitTxResult
struct ExitTxResult final {
  ::rust::String txid;
  ::bark_cxx::ExitTxStatusResult status;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitTxResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitStateDetailsResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitStateDetailsResult
struct ExitStateDetailsResult final {
  ::rust::String kind;
  ::std::uint32_t tip_height CXX_DEFAULT_VALUE(0);
  ::rust::Vec<::rust::String> spent_inputs;
  ::rust::Vec<::bark_cxx::ExitTxResult> transactions;
  bool has_confirmed_block CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult confirmed_block;
  ::std::uint32_t claimable_height CXX_DEFAULT_VALUE(0);
  bool has_claimable_since CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult claimable_since;
  bool has_last_scanned_block CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult last_scanned_block;
  ::rust::String claim_txid;
  ::rust::String txid;
  bool has_block CXX_DEFAULT_VALUE(false);
  ::bark_cxx::ExitBlockRefResult block;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitStateDetailsResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitProgressStatusResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitProgressStatusResult
struct ExitProgressStatusResult final {
  ::rust::String vtxo_id;
  ::rust::String state;
  ::bark_cxx::ExitStateDetailsResult state_details;
  ::rust::String error;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitProgressStatusResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitVtxoResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitVtxoResult
struct ExitVtxoResult final {
  ::rust::String vtxo_id;
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
  ::rust::String state;
  ::bark_cxx::ExitStateDetailsResult state_details;
  ::rust::Vec<::rust::String> history;
  ::rust::Vec<::bark_cxx::ExitStateDetailsResult> history_details;
  ::rust::Vec<::rust::String> txids;
  bool is_claimable CXX_DEFAULT_VALUE(false);
  bool is_initialized CXX_DEFAULT_VALUE(false);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitVtxoResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitTransactionPackageResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitTransactionPackageResult
struct ExitTransactionPackageResult final {
  ::rust::String exit_txid;
  ::rust::String exit_tx_hex;
  ::rust::String child_txid;
  ::rust::String child_tx_hex;
  ::rust::String child_origin;
  bool has_child CXX_DEFAULT_VALUE(false);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitTransactionPackageResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ExitStatusResult
#define CXXBRIDGE1_STRUCT_bark_cxx$ExitStatusResult
struct ExitStatusResult final {
  ::rust::String vtxo_id;
  ::rust::String state;
  ::bark_cxx::ExitStateDetailsResult state_details;
  ::rust::Vec<::rust::String> history;
  ::rust::Vec<::bark_cxx::ExitStateDetailsResult> history_details;
  ::rust::Vec<::bark_cxx::ExitTransactionPackageResult> transactions;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ExitStatusResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$CxxArkInfo
#define CXXBRIDGE1_STRUCT_bark_cxx$CxxArkInfo
struct CxxArkInfo final {
  ::rust::String network;
  ::rust::String server_pubkey;
  ::rust::String mailbox_pubkey;
  ::std::uint64_t round_interval CXX_DEFAULT_VALUE(0);
  ::std::uint16_t nb_round_nonces CXX_DEFAULT_VALUE(0);
  ::std::uint16_t vtxo_exit_delta CXX_DEFAULT_VALUE(0);
  ::std::uint16_t vtxo_lifetime CXX_DEFAULT_VALUE(0);
  ::std::uint16_t htlc_send_expiry_delta CXX_DEFAULT_VALUE(0);
  ::std::uint64_t max_vtxo_amount CXX_DEFAULT_VALUE(0);
  ::std::uint8_t required_board_confirmations CXX_DEFAULT_VALUE(0);
  ::std::uint64_t min_board_amount CXX_DEFAULT_VALUE(0);
  bool ln_receive_anti_dos_required CXX_DEFAULT_VALUE(false);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$CxxArkInfo

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$WalletDebugInfo
#define CXXBRIDGE1_STRUCT_bark_cxx$WalletDebugInfo
struct WalletDebugInfo final {
  ::rust::String network;
  ::rust::String mailbox_id;
  ::rust::String vtxo_xpub;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$WalletDebugInfo

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$LightningSendOptions
#define CXXBRIDGE1_STRUCT_bark_cxx$LightningSendOptions
struct LightningSendOptions final {
  bool wait CXX_DEFAULT_VALUE(false);
  bool has_retry_for CXX_DEFAULT_VALUE(false);
  double retry_for_seconds CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$LightningSendOptions

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$ConfigOpts
#define CXXBRIDGE1_STRUCT_bark_cxx$ConfigOpts
struct ConfigOpts final {
  ::rust::String ark;
  ::rust::String user_agent;
  ::rust::String esplora;
  ::rust::String bitcoind;
  ::rust::String bitcoind_cookie;
  ::rust::String bitcoind_user;
  ::rust::String bitcoind_pass;
  ::std::uint32_t vtxo_refresh_expiry_threshold CXX_DEFAULT_VALUE(0);
  ::std::uint32_t vtxo_key_gap_limit CXX_DEFAULT_VALUE(0);
  ::std::uint64_t fallback_fee_rate CXX_DEFAULT_VALUE(0);
  ::std::uint16_t htlc_recv_claim_delta CXX_DEFAULT_VALUE(0);
  ::std::uint16_t vtxo_exit_margin CXX_DEFAULT_VALUE(0);
  ::std::uint32_t round_tx_required_confirmations CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$ConfigOpts

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$CreateOpts
#define CXXBRIDGE1_STRUCT_bark_cxx$CreateOpts
struct CreateOpts final {
  bool regtest CXX_DEFAULT_VALUE(false);
  bool signet CXX_DEFAULT_VALUE(false);
  bool bitcoin CXX_DEFAULT_VALUE(false);
  ::rust::String mnemonic;
  ::std::uint32_t const *birthday_height CXX_DEFAULT_VALUE(nullptr);
  ::bark_cxx::ConfigOpts config;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$CreateOpts

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$SendManyOutput
#define CXXBRIDGE1_STRUCT_bark_cxx$SendManyOutput
struct SendManyOutput final {
  ::rust::String destination;
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$SendManyOutput

#ifndef CXXBRIDGE1_ENUM_bark_cxx$RefreshModeType
#define CXXBRIDGE1_ENUM_bark_cxx$RefreshModeType
enum class RefreshModeType : ::std::uint8_t {
  DefaultThreshold = 0,
  ThresholdBlocks = 1,
  ThresholdHours = 2,
  Counterparty = 3,
  All = 4,
  Specific = 5,
};
#endif // CXXBRIDGE1_ENUM_bark_cxx$RefreshModeType

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$LightningReceive
#define CXXBRIDGE1_STRUCT_bark_cxx$LightningReceive
struct LightningReceive final {
  ::rust::String state;
  ::rust::String phase;
  ::rust::String payment_hash;
  ::rust::String payment_preimage;
  ::rust::String invoice;
  ::rust::Vec<::rust::String> htlc_vtxo_ids;
  bool has_movement_id CXX_DEFAULT_VALUE(false);
  ::std::uint32_t movement_id CXX_DEFAULT_VALUE(0);
  bool has_amount_sat CXX_DEFAULT_VALUE(false);
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);
  bool has_settled_at CXX_DEFAULT_VALUE(false);
  ::std::uint64_t settled_at CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$LightningReceive

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OffchainBalance
#define CXXBRIDGE1_STRUCT_bark_cxx$OffchainBalance
struct OffchainBalance final {
  // All amounts are in satoshis. Available to pay now.
  ::std::uint64_t spendable CXX_DEFAULT_VALUE(0);
  // Expired VTXOs or VTXOs at the server's exit-depth limit.
  ::std::uint64_t needs_refresh CXX_DEFAULT_VALUE(0);
  // Sum of the seven pending categories below.
  ::std::uint64_t pending CXX_DEFAULT_VALUE(0);
  // spendable + needs_refresh + pending; summary fields overlap the breakdown.
  ::std::uint64_t total CXX_DEFAULT_VALUE(0);
  // Coins held by outgoing Ark payments, including change.
  ::std::uint64_t pending_arkoor_send CXX_DEFAULT_VALUE(0);
  // Coins that are in the process of being sent over Lightning.
  ::std::uint64_t pending_lightning_send CXX_DEFAULT_VALUE(0);
  // Received HTLC coins whose preimage has been revealed.
  ::std::uint64_t claimable_lightning_receive CXX_DEFAULT_VALUE(0);
  // Coins locked as round inputs.
  ::std::uint64_t pending_in_round CXX_DEFAULT_VALUE(0);
  // Coins whose exit committed onchain, awaiting claim.
  ::std::uint64_t pending_exit CXX_DEFAULT_VALUE(0);
  // Coins that are pending sufficient confirmations from board transactions.
  ::std::uint64_t pending_board CXX_DEFAULT_VALUE(0);
  // Coins held until offboard broadcast, including change.
  ::std::uint64_t pending_offboard CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OffchainBalance

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$OnChainBalance
#define CXXBRIDGE1_STRUCT_bark_cxx$OnChainBalance
struct OnChainBalance final {
  // All coinbase outputs not yet matured
  ::std::uint64_t immature CXX_DEFAULT_VALUE(0);
  // Unconfirmed UTXOs generated by a wallet tx
  ::std::uint64_t trusted_pending CXX_DEFAULT_VALUE(0);
  // Unconfirmed UTXOs received from an external wallet
  ::std::uint64_t untrusted_pending CXX_DEFAULT_VALUE(0);
  // Confirmed and immediately spendable balance
  ::std::uint64_t confirmed CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$OnChainBalance

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$KeyPairResult
#define CXXBRIDGE1_STRUCT_bark_cxx$KeyPairResult
struct KeyPairResult final {
  ::rust::String public_key;
  ::rust::String secret_key;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$KeyPairResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$MailboxAuthorizationResult
#define CXXBRIDGE1_STRUCT_bark_cxx$MailboxAuthorizationResult
struct MailboxAuthorizationResult final {
  ::rust::String mailbox_id;
  ::std::int64_t expiry CXX_DEFAULT_VALUE(0);
  ::rust::String encoded;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$MailboxAuthorizationResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BarkMovement
#define CXXBRIDGE1_STRUCT_bark_cxx$BarkMovement
struct BarkMovement final {
  ::std::uint32_t id CXX_DEFAULT_VALUE(0);
  ::rust::String status;
  ::rust::String subsystem_name;
  ::rust::String subsystem_kind;
  ::rust::String metadata_json;
  ::std::int64_t intended_balance_sat CXX_DEFAULT_VALUE(0);
  ::std::int64_t effective_balance_sat CXX_DEFAULT_VALUE(0);
  ::std::uint64_t offchain_fee_sat CXX_DEFAULT_VALUE(0);
  ::rust::Vec<::bark_cxx::BarkMovementDestination> sent_to;
  ::rust::Vec<::bark_cxx::BarkMovementDestination> received_on;
  ::rust::Vec<::rust::String> input_vtxos;
  ::rust::Vec<::rust::String> output_vtxos;
  ::rust::Vec<::rust::String> exited_vtxos;
  ::rust::String created_at;
  ::rust::String updated_at;
  ::rust::String completed_at;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BarkMovement

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$NotificationEvent
#define CXXBRIDGE1_STRUCT_bark_cxx$NotificationEvent
struct NotificationEvent final {
  ::rust::String kind;
  bool has_movement CXX_DEFAULT_VALUE(false);
  ::bark_cxx::BarkMovement movement;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$NotificationEvent

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$NotificationPollResult
#define CXXBRIDGE1_STRUCT_bark_cxx$NotificationPollResult
struct NotificationPollResult final {
  bool has_event CXX_DEFAULT_VALUE(false);
  bool is_active CXX_DEFAULT_VALUE(false);
  ::bark_cxx::NotificationEvent event;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$NotificationPollResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotInfo
#define CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotInfo
struct WalletSnapshotInfo final {
  ::rust::String path;
  ::std::uint64_t size_bytes CXX_DEFAULT_VALUE(0);
  ::rust::String sha256;
  ::rust::String network;
  ::rust::String wallet_fingerprint;
  ::rust::String server_pubkey;
  ::rust::String mailbox_pubkey;
  ::std::uint32_t schema_version CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotInfo

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotExpectation
#define CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotExpectation
struct WalletSnapshotExpectation final {
  bool has_network CXX_DEFAULT_VALUE(false);
  ::rust::String network;
  bool has_wallet_fingerprint CXX_DEFAULT_VALUE(false);
  ::rust::String wallet_fingerprint;
  bool has_server_pubkey CXX_DEFAULT_VALUE(false);
  ::rust::String server_pubkey;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$WalletSnapshotExpectation

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$StateChangeEvent
#define CXXBRIDGE1_STRUCT_bark_cxx$StateChangeEvent
struct StateChangeEvent final {
  ::std::uint64_t sequence CXX_DEFAULT_VALUE(0);
  ::rust::String reason;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$StateChangeEvent

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$StateChangePollResult
#define CXXBRIDGE1_STRUCT_bark_cxx$StateChangePollResult
struct StateChangePollResult final {
  bool has_event CXX_DEFAULT_VALUE(false);
  bool is_active CXX_DEFAULT_VALUE(false);
  ::bark_cxx::StateChangeEvent event;

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$StateChangePollResult

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$BarkMovementDestination
#define CXXBRIDGE1_STRUCT_bark_cxx$BarkMovementDestination
struct BarkMovementDestination final {
  ::rust::String destination;
  ::rust::String payment_method;
  ::std::uint64_t amount_sat CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$BarkMovementDestination

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$PendingRoundStatus
#define CXXBRIDGE1_STRUCT_bark_cxx$PendingRoundStatus
struct PendingRoundStatus final {
  ::std::uint32_t round_id CXX_DEFAULT_VALUE(0);
  ::rust::String status;
  ::rust::String funding_txid;
  ::rust::Vec<::rust::String> unsigned_funding_txids;
  ::rust::String error;
  bool is_final CXX_DEFAULT_VALUE(false);
  bool is_success CXX_DEFAULT_VALUE(false);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$PendingRoundStatus

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$DelegatedRoundState
#define CXXBRIDGE1_STRUCT_bark_cxx$DelegatedRoundState
struct DelegatedRoundState final {
  bool has_round CXX_DEFAULT_VALUE(false);
  ::std::uint32_t round_id CXX_DEFAULT_VALUE(0);

  using IsRelocatable = ::std::true_type;
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$DelegatedRoundState

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$NotificationSubscription
#define CXXBRIDGE1_STRUCT_bark_cxx$NotificationSubscription
struct NotificationSubscription final : public ::rust::Opaque {
  void stop();
  bool is_active() const noexcept;
  ::bark_cxx::NotificationPollResult wait_next(::std::uint32_t timeout_ms);
  ~NotificationSubscription() = delete;

private:
  friend ::rust::layout;
  struct layout {
    static ::std::size_t size() noexcept;
    static ::std::size_t align() noexcept;
  };
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$NotificationSubscription

#ifndef CXXBRIDGE1_STRUCT_bark_cxx$StateChangeSubscription
#define CXXBRIDGE1_STRUCT_bark_cxx$StateChangeSubscription
struct StateChangeSubscription final : public ::rust::Opaque {
  void stop();
  bool is_active() const noexcept;
  ::bark_cxx::StateChangePollResult wait_next(::std::uint32_t timeout_ms);
  ~StateChangeSubscription() = delete;

private:
  friend ::rust::layout;
  struct layout {
    static ::std::size_t size() noexcept;
    static ::std::size_t align() noexcept;
  };
};
#endif // CXXBRIDGE1_STRUCT_bark_cxx$StateChangeSubscription

void init_logger() noexcept;

::rust::String bark_version() noexcept;

::rust::String create_mnemonic();

bool is_wallet_loaded() noexcept;

void close_wallet();

::bark_cxx::WalletSnapshotInfo create_wallet_snapshot(::rust::Str destination_path);

::bark_cxx::WalletSnapshotInfo validate_wallet_snapshot(::rust::Str path, ::bark_cxx::WalletSnapshotExpectation expected);

::bark_cxx::CxxArkInfo get_ark_info();

::bark_cxx::WalletDebugInfo debug_info();

::bark_cxx::OffchainBalance offchain_balance();

::bark_cxx::KeyPairResult derive_store_next_keypair();

::bark_cxx::KeyPairResult peek_keypair(::std::uint32_t index);

::bark_cxx::NewAddressResult new_address();

::bark_cxx::NewAddressResult peek_address(::std::uint32_t index);

::rust::String sign_message(::rust::Str message, ::std::uint32_t index);

::rust::String sign_messsage_with_mnemonic(::rust::Str message, ::rust::Str mnemonic, ::rust::Str network, ::std::uint32_t index);

::bark_cxx::KeyPairResult derive_keypair_from_mnemonic(::rust::Str mnemonic, ::rust::Str network, ::std::uint32_t index);

bool verify_message(::rust::Str message, ::rust::Str signature, ::rust::Str public_key);

::rust::Vec<::bark_cxx::BarkMovement> history();

::rust::Vec<::bark_cxx::BarkVtxo> vtxos();

void update_history_metadata(::std::uint32_t movement_id, ::rust::Str patch_json);

::bark_cxx::BarkVtxo decode_vtxo_hex(::rust::Str vtxo_hex);

::bark_cxx::BarkVtxo import_vtxo(::rust::Str vtxo_hex);

void dangerous_drop_vtxo(::rust::Str vtxo_id);

void unlock_vtxos(::rust::Vec<::rust::String> vtxo_ids);

::rust::Vec<::bark_cxx::BarkVtxo> get_expiring_vtxos(::std::uint32_t threshold);

::bark_cxx::DelegatedRoundState refresh_vtxos_delegated(::rust::Vec<::rust::String> vtxo_ids);

::std::uint32_t const *get_first_expiring_vtxo_blockheight();

::std::uint32_t const *get_next_required_refresh_blockheight();

::bark_cxx::Bolt11Invoice bolt11_invoice(::std::uint64_t amount_sat, ::rust::String const *description, ::rust::String const *token);

::bark_cxx::LightningReceive lightning_receive_status(::rust::String payment_hash);

::bark_cxx::LightningPaymentResult check_lightning_payment(::rust::String payment_hash, bool wait);

void sync_pending_boards();

void maintenance();

void maintenance_delegated();

void maintenance_refresh();

void refresh_server();

void sync();

void create_wallet(::rust::Str datadir, ::bark_cxx::CreateOpts opts);

void load_wallet(::rust::Str datadir, ::bark_cxx::CreateOpts config);

::bark_cxx::RestoreWalletResult restore_wallet_from_ark_server(::rust::Str datadir, ::bark_cxx::CreateOpts opts);

::bark_cxx::BoardResult board_amount(::std::uint64_t amount_sat);

::bark_cxx::BoardResult board_all();

void validate_arkoor_address(::rust::Str address);

::bark_cxx::ArkoorPaymentResult send_arkoor_payment(::rust::Str destination, ::std::uint64_t amount_sat);

::bark_cxx::ParsedPaymentRequest parse_payment_request(::rust::Str payment);

::bark_cxx::BarkFeeEstimate estimate_arkoor_payment_fee(::std::uint64_t amount_sat);

::bark_cxx::BarkFeeEstimate estimate_board_offchain_fee(::std::uint64_t amount_sat);

::bark_cxx::BarkFeeEstimate estimate_refresh_fee(::rust::Vec<::rust::String> vtxo_ids);

::bark_cxx::BarkFeeEstimate estimate_lightning_send_fee(::std::uint64_t amount_sat);

::bark_cxx::LightningPaymentResult pay_lightning_invoice(::rust::Str destination, ::std::uint64_t const *amount_sat, ::bark_cxx::LightningSendOptions options);

::bark_cxx::LightningPaymentResult pay_lightning_invoice_with_origin(::rust::Str invoice, ::rust::Str origin_method, ::rust::Str origin_value, ::bark_cxx::LightningSendOptions options);

::bark_cxx::LightningPaymentResult pay_lightning_offer(::rust::Str offer, ::std::uint64_t const *amount_sat, ::bark_cxx::LightningSendOptions options);

::bark_cxx::LightningPaymentResult pay_lightning_address(::rust::Str addr, ::std::uint64_t amount_sat, ::rust::Str comment, ::bark_cxx::LightningSendOptions options);

::rust::Vec<::bark_cxx::ExitProgressStatusResult> progress_exits(::std::uint64_t const *fee_rate_sat_per_kvb);

::bark_cxx::ExitFeeEstimate estimate_emergency_exit_fee(::rust::Vec<::rust::String> vtxo_ids, ::std::uint64_t const *fee_rate_sat_per_kvb, ::rust::String const *destination_address, double const *fee_margin);

::rust::Vec<::bark_cxx::ExitVtxoResult> get_exit_vtxos();

::rust::Vec<::bark_cxx::ExitVtxoResult> list_claimable();

::bark_cxx::ExitStatusResult const *get_exit_status(::rust::Str vtxo_id, bool include_history, bool include_transactions);

bool has_pending_exits();

::std::uint64_t pending_exit_total();

::std::uint32_t const *all_claimable_at_height();

::rust::String drain_exits(::rust::Vec<::rust::String> vtxo_ids, ::rust::Str destination_address, ::std::uint64_t const *fee_rate_sat_per_kvb);

::rust::String extract_transaction(::rust::Str psbt);

::rust::String broadcast_transaction(::rust::Str tx_hex);

::bark_cxx::OffboardResult send_onchain(::rust::Str destination, ::std::uint64_t amount_sat);

::bark_cxx::BarkFeeEstimate estimate_send_onchain(::rust::Str destination, ::std::uint64_t amount_sat);

::bark_cxx::OffboardResult offboard_specific(::rust::Vec<::rust::String> vtxo_ids, ::rust::Str destination_address);

::bark_cxx::OffboardResult offboard_all(::rust::Str destination_address);

::bark_cxx::BarkFeeEstimate estimate_offboard_all(::rust::Str destination_address);

::bark_cxx::LightningReceive try_claim_lightning_receive(::rust::String payment_hash, bool wait);

void try_claim_all_lightning_receives(bool wait);

void start_exit_for_entire_wallet();

void start_exit_for_vtxos(::rust::Vec<::rust::String> vtxo_ids);

void cancel_exit(::rust::Str vtxo_id);

void sync_exit();

::rust::Vec<::bark_cxx::PendingRoundStatus> sync_pending_rounds();

::bark_cxx::KeyPairResult mailbox_keypair();

::bark_cxx::MailboxAuthorizationResult mailbox_authorization(::std::int64_t authorization_expiry);

::rust::Box<::bark_cxx::NotificationSubscription> subscribe_notifications();

::rust::Box<::bark_cxx::NotificationSubscription> subscribe_arkoor_address_movements(::rust::Str address);

::rust::Box<::bark_cxx::NotificationSubscription> subscribe_lightning_payment_movements(::rust::Str payment_hash);

::rust::Box<::bark_cxx::StateChangeSubscription> subscribe_wallet_state_changes();

::bark_cxx::OnChainBalance onchain_balance();

void onchain_sync();

bool onchain_is_mine(::rust::Str address);

::rust::String onchain_list_unspent();

::rust::String onchain_utxos();

::bark_cxx::BarkFeeRates onchain_fee_rates();

::rust::Vec<::bark_cxx::OnchainTransactionInfo> onchain_transactions();

::rust::String onchain_address();

::bark_cxx::OnchainPaymentResult onchain_send(::rust::Str destination, ::std::uint64_t amount_sat, ::std::uint64_t const *fee_rate);

::rust::String onchain_drain(::rust::Str destination, ::std::uint64_t const *fee_rate);

::rust::String onchain_send_many(::rust::Vec<::bark_cxx::SendManyOutput> outputs, ::std::uint64_t const *fee_rate);
} // namespace bark_cxx

#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
