/*
 *   Copyright 2016-2026. Couchbase, Inc.
 *   All Rights Reserved.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

// ====================================================================================================
// AUTOGENERATED FILE START - DO NOT EDIT MANUALLY
// Generated-On: 2026-02-25 14:23:36
// ====================================================================================================

#pragma once

#include "Python.h"
#include "cpp_core_enums_autogen.hxx"
#include "cpp_core_types.hxx"
#include "cpp_types.hxx"
#include "pytocbpp_defs.hxx"
#include "result.hxx"
#include "utils.hxx"
#include <core/diagnostics.hxx>
#include <core/impl/subdoc/command.hxx>
#include <core/management/analytics_dataset.hxx>
#include <core/management/analytics_index.hxx>
#include <core/management/analytics_link_azure_blob_external.hxx>
#include <core/management/analytics_link_couchbase_remote.hxx>
#include <core/management/analytics_link_s3_external.hxx>
#include <core/management/bucket_settings.hxx>
#include <core/management/design_document.hxx>
#include <core/management/eventing_function.hxx>
#include <core/management/eventing_status.hxx>
#include <core/management/rbac.hxx>
#include <core/management/search_index.hxx>
#include <core/operations/document_analytics.hxx>
#include <core/operations/document_get_all_replicas.hxx>
#include <core/operations/document_lookup_in.hxx>
#include <core/operations/document_lookup_in_all_replicas.hxx>
#include <core/operations/document_lookup_in_any_replica.hxx>
#include <core/operations/document_mutate_in.hxx>
#include <core/operations/document_query.hxx>
#include <core/operations/document_search.hxx>
#include <core/operations/document_view.hxx>
#include <core/operations/management/analytics_link_connect.hxx>
#include <core/operations/management/analytics_link_create.hxx>
#include <core/operations/management/analytics_link_disconnect.hxx>
#include <core/operations/management/analytics_link_drop.hxx>
#include <core/operations/management/analytics_link_get_all.hxx>
#include <core/operations/management/analytics_link_replace.hxx>
#include <core/operations/management/analytics_problem.hxx>
#include <core/operations/management/bucket_describe.hxx>
#include <core/operations/management/cluster_describe.hxx>
#include <core/operations/management/eventing_problem.hxx>
#include <core/operations/management/query_index_build.hxx>
#include <core/operations/management/query_index_build_deferred.hxx>
#include <core/operations/management/query_index_create.hxx>
#include <core/operations/management/query_index_drop.hxx>
#include <core/range_scan_options.hxx>
#include <core/range_scan_orchestrator_options.hxx>
#include <core/topology/collections_manifest.hxx>
#include <core/tracing/wrapper_sdk_tracer.hxx>
#include <couchbase/management/query_index.hxx>

namespace pycbc
{

// ==========================================================================================
// couchbase::core::diag::endpoint_diag_info
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::diag::endpoint_diag_info> {
  using endpoint_diag_info = couchbase::core::diag::endpoint_diag_info;

  static inline endpoint_diag_info from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const endpoint_diag_info& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<couchbase::core::service_type>(pyObj, "type", cppObj.type);
    add_field<std::string>(pyObj, "id", cppObj.id);
    add_field<std::optional<std::chrono::microseconds>>(
      pyObj, "last_activity", cppObj.last_activity);
    add_field<std::string>(pyObj, "remote", cppObj.remote);
    add_field<std::string>(pyObj, "local", cppObj.local);
    add_field<couchbase::core::diag::endpoint_state>(pyObj, "state", cppObj.state);
    add_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "details", cppObj.details);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::diag::diagnostics_result
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::diag::diagnostics_result> {
  using diagnostics_result = couchbase::core::diag::diagnostics_result;

  static inline diagnostics_result from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const diagnostics_result& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "id", cppObj.id);
    add_field<std::string>(pyObj, "sdk", cppObj.sdk);
    add_field<std::map<couchbase::core::service_type,
                       std::vector<couchbase::core::diag::endpoint_diag_info>>>(
      pyObj, "services", cppObj.services);
    add_field<std::int32_t>(pyObj, "version", cppObj.version);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::diag::endpoint_ping_info
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::diag::endpoint_ping_info> {
  using endpoint_ping_info = couchbase::core::diag::endpoint_ping_info;

  static inline endpoint_ping_info from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const endpoint_ping_info& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<couchbase::core::service_type>(pyObj, "type", cppObj.type);
    add_field<std::string>(pyObj, "id", cppObj.id);
    add_field<std::chrono::microseconds>(pyObj, "latency", cppObj.latency);
    add_field<std::string>(pyObj, "remote", cppObj.remote);
    add_field<std::string>(pyObj, "local", cppObj.local);
    add_field<couchbase::core::diag::ping_state>(pyObj, "state", cppObj.state);
    add_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "error", cppObj.error);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::diag::ping_result
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::diag::ping_result> {
  using ping_result = couchbase::core::diag::ping_result;

  static inline ping_result from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const ping_result& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "id", cppObj.id);
    add_field<std::string>(pyObj, "sdk", cppObj.sdk);
    add_field<std::map<couchbase::core::service_type,
                       std::vector<couchbase::core::diag::endpoint_ping_info>>>(
      pyObj, "services", cppObj.services);
    add_field<std::int32_t>(pyObj, "version", cppObj.version);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::get_all_replicas_response::entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::get_all_replicas_response::entry> {
  using entry = couchbase::core::operations::get_all_replicas_response::entry;

  static inline entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    add_field<couchbase::cas>(pyObj, "cas", cppObj.cas);
    add_field<std::uint32_t>(pyObj, "flags", cppObj.flags);
    add_field<bool>(pyObj, "replica", cppObj.replica);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::impl::subdoc::command
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::impl::subdoc::command> {
  using command = couchbase::core::impl::subdoc::command;

  static inline command from_py(PyObject* pyObj)
  {
    command cppObj;

    extract_field<couchbase::core::impl::subdoc::opcode>(pyObj, "opcode", cppObj.opcode_);
    extract_field<std::string>(pyObj, "path", cppObj.path_);
    extract_field<std::vector<std::byte>>(pyObj, "value", cppObj.value_);
    extract_field<std::byte>(pyObj, "flags", cppObj.flags_);
    extract_field<std::size_t>(pyObj, "original_index", cppObj.original_index_);
    return cppObj;
  }

  static inline PyObject* to_py(const command& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<couchbase::core::impl::subdoc::opcode>(pyObj, "opcode", cppObj.opcode_);
    add_field<std::string>(pyObj, "path", cppObj.path_);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value_);
    add_field<std::byte>(pyObj, "flags", cppObj.flags_);
    add_field<std::size_t>(pyObj, "original_index", cppObj.original_index_);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::lookup_in_all_replicas_response::entry::lookup_in_entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::lookup_in_all_replicas_response::entry::lookup_in_entry> {
  using lookup_in_entry =
    couchbase::core::operations::lookup_in_all_replicas_response::entry::lookup_in_entry;

  static inline lookup_in_entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const lookup_in_entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "path", cppObj.path);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    add_field<std::size_t>(pyObj, "original_index", cppObj.original_index);
    add_field<bool>(pyObj, "exists", cppObj.exists);
    add_field<couchbase::core::protocol::subdoc_opcode>(pyObj, "opcode", cppObj.opcode);
    add_field<couchbase::core::key_value_status_code>(pyObj, "status", cppObj.status);
    add_field<std::error_code>(pyObj, "ec", cppObj.ec);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::lookup_in_all_replicas_response::entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_all_replicas_response::entry> {
  using entry = couchbase::core::operations::lookup_in_all_replicas_response::entry;

  static inline entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<
      couchbase::core::operations::lookup_in_all_replicas_response::entry::lookup_in_entry>>(
      pyObj, "fields", cppObj.fields);
    add_field<couchbase::cas>(pyObj, "cas", cppObj.cas);
    add_field<bool>(pyObj, "deleted", cppObj.deleted);
    add_field<bool>(pyObj, "is_replica", cppObj.is_replica);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::lookup_in_any_replica_response::entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_any_replica_response::entry> {
  using entry = couchbase::core::operations::lookup_in_any_replica_response::entry;

  static inline entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "path", cppObj.path);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    add_field<std::size_t>(pyObj, "original_index", cppObj.original_index);
    add_field<bool>(pyObj, "exists", cppObj.exists);
    add_field<couchbase::core::protocol::subdoc_opcode>(pyObj, "opcode", cppObj.opcode);
    add_field<couchbase::core::key_value_status_code>(pyObj, "status", cppObj.status);
    add_field<std::error_code>(pyObj, "ec", cppObj.ec);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::lookup_in_response::entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::lookup_in_response::entry> {
  using entry = couchbase::core::operations::lookup_in_response::entry;

  static inline entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "path", cppObj.path);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    add_field<std::size_t>(pyObj, "original_index", cppObj.original_index);
    add_field<bool>(pyObj, "exists", cppObj.exists);
    add_field<couchbase::core::protocol::subdoc_opcode>(pyObj, "opcode", cppObj.opcode);
    add_field<couchbase::core::key_value_status_code>(pyObj, "status", cppObj.status);
    add_field<std::error_code>(pyObj, "ec", cppObj.ec);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::mutate_in_response::entry
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::mutate_in_response::entry> {
  using entry = couchbase::core::operations::mutate_in_response::entry;

  static inline entry from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const entry& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "path", cppObj.path);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    add_field<std::size_t>(pyObj, "original_index", cppObj.original_index);
    add_field<couchbase::core::protocol::subdoc_opcode>(pyObj, "opcode", cppObj.opcode);
    add_field<couchbase::core::key_value_status_code>(pyObj, "status", cppObj.status);
    add_field<std::error_code>(pyObj, "ec", cppObj.ec);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::scan_term
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::scan_term> {
  using scan_term = couchbase::core::scan_term;

  static inline scan_term from_py(PyObject* pyObj)
  {
    scan_term cppObj;

    extract_field<std::string>(pyObj, "term", cppObj.term);
    extract_field<bool>(pyObj, "exclusive", cppObj.exclusive);
    return cppObj;
  }

  static inline PyObject* to_py(const scan_term& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "term", cppObj.term);
    add_field<bool>(pyObj, "exclusive", cppObj.exclusive);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan> {
  using range_scan = couchbase::core::range_scan;

  static inline range_scan from_py(PyObject* pyObj)
  {
    range_scan cppObj;

    extract_field<std::optional<couchbase::core::scan_term>>(pyObj, "from", cppObj.from);
    extract_field<std::optional<couchbase::core::scan_term>>(pyObj, "to", cppObj.to);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::optional<couchbase::core::scan_term>>(pyObj, "from", cppObj.from);
    add_field<std::optional<couchbase::core::scan_term>>(pyObj, "to", cppObj.to);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::prefix_scan
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::prefix_scan> {
  using prefix_scan = couchbase::core::prefix_scan;

  static inline prefix_scan from_py(PyObject* pyObj)
  {
    prefix_scan cppObj;

    extract_field<std::string>(pyObj, "prefix", cppObj.prefix);
    return cppObj;
  }

  static inline PyObject* to_py(const prefix_scan& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "prefix", cppObj.prefix);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::sampling_scan
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::sampling_scan> {
  using sampling_scan = couchbase::core::sampling_scan;

  static inline sampling_scan from_py(PyObject* pyObj)
  {
    sampling_scan cppObj;

    extract_field<std::size_t>(pyObj, "limit", cppObj.limit);
    extract_field<std::optional<std::uint64_t>>(pyObj, "seed", cppObj.seed);
    return cppObj;
  }

  static inline PyObject* to_py(const sampling_scan& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::size_t>(pyObj, "limit", cppObj.limit);
    add_field<std::optional<std::uint64_t>>(pyObj, "seed", cppObj.seed);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_snapshot_requirements
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_snapshot_requirements> {
  using range_snapshot_requirements = couchbase::core::range_snapshot_requirements;

  static inline range_snapshot_requirements from_py(PyObject* pyObj)
  {
    range_snapshot_requirements cppObj;

    extract_field<std::uint64_t>(pyObj, "vbucket_uuid", cppObj.vbucket_uuid);
    extract_field<std::uint64_t>(pyObj, "sequence_number", cppObj.sequence_number);
    extract_field<bool>(pyObj, "sequence_number_exists", cppObj.sequence_number_exists);
    return cppObj;
  }

  static inline PyObject* to_py(const range_snapshot_requirements& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "vbucket_uuid", cppObj.vbucket_uuid);
    add_field<std::uint64_t>(pyObj, "sequence_number", cppObj.sequence_number);
    add_field<bool>(pyObj, "sequence_number_exists", cppObj.sequence_number_exists);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_create_options
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_create_options> {
  using range_scan_create_options = couchbase::core::range_scan_create_options;

  static inline range_scan_create_options from_py(PyObject* pyObj)
  {
    range_scan_create_options cppObj;

    extract_field<std::string>(pyObj, "scope_name", cppObj.scope_name);
    extract_field<std::string>(pyObj, "collection_name", cppObj.collection_name);
    extract_field<std::variant<std::monostate,
                               couchbase::core::range_scan,
                               couchbase::core::prefix_scan,
                               couchbase::core::sampling_scan>>(
      pyObj, "scan_type", cppObj.scan_type);
    extract_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    extract_field<std::uint32_t>(pyObj, "collection_id", cppObj.collection_id);
    extract_field<std::optional<couchbase::core::range_snapshot_requirements>>(
      pyObj, "snapshot_requirements", cppObj.snapshot_requirements);
    extract_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    // retry_strategy
    // internal
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_create_options& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "scope_name", cppObj.scope_name);
    add_field<std::string>(pyObj, "collection_name", cppObj.collection_name);
    add_field<std::variant<std::monostate,
                           couchbase::core::range_scan,
                           couchbase::core::prefix_scan,
                           couchbase::core::sampling_scan>>(pyObj, "scan_type", cppObj.scan_type);
    add_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    add_field<std::uint32_t>(pyObj, "collection_id", cppObj.collection_id);
    add_field<std::optional<couchbase::core::range_snapshot_requirements>>(
      pyObj, "snapshot_requirements", cppObj.snapshot_requirements);
    add_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    // retry_strategy
    // internal

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_create_result
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_create_result> {
  using range_scan_create_result = couchbase::core::range_scan_create_result;

  static inline range_scan_create_result from_py(PyObject* pyObj)
  {
    range_scan_create_result cppObj;

    extract_field<std::vector<std::byte>>(pyObj, "scan_uuid", cppObj.scan_uuid);
    extract_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_create_result& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<std::byte>>(pyObj, "scan_uuid", cppObj.scan_uuid);
    add_field<bool>(pyObj, "ids_only", cppObj.ids_only);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_continue_options
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_continue_options> {
  using range_scan_continue_options = couchbase::core::range_scan_continue_options;

  static inline range_scan_continue_options from_py(PyObject* pyObj)
  {
    range_scan_continue_options cppObj;

    extract_field<std::uint32_t>(pyObj, "batch_item_limit", cppObj.batch_item_limit);
    extract_field<std::uint32_t>(pyObj, "batch_byte_limit", cppObj.batch_byte_limit);
    extract_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    extract_field<std::chrono::milliseconds>(pyObj, "batch_time_limit", cppObj.batch_time_limit);
    // retry_strategy
    // internal
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_continue_options& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "batch_item_limit", cppObj.batch_item_limit);
    add_field<std::uint32_t>(pyObj, "batch_byte_limit", cppObj.batch_byte_limit);
    add_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    add_field<std::chrono::milliseconds>(pyObj, "batch_time_limit", cppObj.batch_time_limit);
    // retry_strategy
    // internal

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_continue_result
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_continue_result> {
  using range_scan_continue_result = couchbase::core::range_scan_continue_result;

  static inline range_scan_continue_result from_py(PyObject* pyObj)
  {
    range_scan_continue_result cppObj;

    extract_field<bool>(pyObj, "more", cppObj.more);
    extract_field<bool>(pyObj, "complete", cppObj.complete);
    extract_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_continue_result& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<bool>(pyObj, "more", cppObj.more);
    add_field<bool>(pyObj, "complete", cppObj.complete);
    add_field<bool>(pyObj, "ids_only", cppObj.ids_only);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_cancel_options
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_cancel_options> {
  using range_scan_cancel_options = couchbase::core::range_scan_cancel_options;

  static inline range_scan_cancel_options from_py(PyObject* pyObj)
  {
    range_scan_cancel_options cppObj;

    extract_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    // retry_strategy
    // internal
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_cancel_options& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    // retry_strategy
    // internal

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_item_body
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_item_body> {
  using range_scan_item_body = couchbase::core::range_scan_item_body;

  static inline range_scan_item_body from_py(PyObject* pyObj)
  {
    range_scan_item_body cppObj;

    extract_field<std::uint32_t>(pyObj, "flags", cppObj.flags);
    extract_field<std::uint32_t>(pyObj, "expiry", cppObj.expiry);
    extract_field<couchbase::cas>(pyObj, "cas", cppObj.cas);
    extract_field<std::uint64_t>(pyObj, "sequence_number", cppObj.sequence_number);
    extract_field<std::byte>(pyObj, "datatype", cppObj.datatype);
    extract_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_item_body& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "flags", cppObj.flags);
    add_field<std::uint32_t>(pyObj, "expiry", cppObj.expiry);
    add_field<couchbase::cas>(pyObj, "cas", cppObj.cas);
    add_field<std::uint64_t>(pyObj, "sequence_number", cppObj.sequence_number);
    add_field<std::byte>(pyObj, "datatype", cppObj.datatype);
    add_field<std::vector<std::byte>>(pyObj, "value", cppObj.value);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_item
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_item> {
  using range_scan_item = couchbase::core::range_scan_item;

  static inline range_scan_item from_py(PyObject* pyObj)
  {
    range_scan_item cppObj;

    extract_field<std::string>(pyObj, "key", cppObj.key);
    extract_field<std::optional<couchbase::core::range_scan_item_body>>(pyObj, "body", cppObj.body);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_item& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "key", cppObj.key);
    add_field<std::optional<couchbase::core::range_scan_item_body>>(pyObj, "body", cppObj.body);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::mutation_state
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::mutation_state> {
  using mutation_state = couchbase::core::mutation_state;

  static inline mutation_state from_py(PyObject* pyObj)
  {
    mutation_state cppObj;

    extract_field<std::vector<couchbase::mutation_token>>(pyObj, "tokens", cppObj.tokens);
    return cppObj;
  }

  static inline PyObject* to_py(const mutation_state& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<couchbase::mutation_token>>(pyObj, "tokens", cppObj.tokens);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::range_scan_orchestrator_options
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::range_scan_orchestrator_options> {
  using range_scan_orchestrator_options = couchbase::core::range_scan_orchestrator_options;

  static inline range_scan_orchestrator_options from_py(PyObject* pyObj)
  {
    range_scan_orchestrator_options cppObj;

    extract_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    extract_field<std::optional<couchbase::core::mutation_state>>(
      pyObj, "consistent_with", cppObj.consistent_with);
    extract_field<std::uint32_t>(pyObj, "batch_item_limit", cppObj.batch_item_limit);
    extract_field<std::uint32_t>(pyObj, "batch_byte_limit", cppObj.batch_byte_limit);
    extract_field<std::uint16_t>(pyObj, "concurrency", cppObj.concurrency);
    // retry_strategy
    extract_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);
    return cppObj;
  }

  static inline PyObject* to_py(const range_scan_orchestrator_options& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<bool>(pyObj, "ids_only", cppObj.ids_only);
    add_field<std::optional<couchbase::core::mutation_state>>(
      pyObj, "consistent_with", cppObj.consistent_with);
    add_field<std::uint32_t>(pyObj, "batch_item_limit", cppObj.batch_item_limit);
    add_field<std::uint32_t>(pyObj, "batch_byte_limit", cppObj.batch_byte_limit);
    add_field<std::uint16_t>(pyObj, "concurrency", cppObj.concurrency);
    // retry_strategy
    add_field<std::chrono::milliseconds>(pyObj, "timeout", cppObj.timeout);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::analytics_response::analytics_metrics
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::analytics_response::analytics_metrics> {
  using analytics_metrics = couchbase::core::operations::analytics_response::analytics_metrics;

  static inline analytics_metrics from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const analytics_metrics& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::chrono::nanoseconds>(pyObj, "elapsed_time", cppObj.elapsed_time);
    add_field<std::chrono::nanoseconds>(pyObj, "execution_time", cppObj.execution_time);
    add_field<std::uint64_t>(pyObj, "result_count", cppObj.result_count);
    add_field<std::uint64_t>(pyObj, "result_size", cppObj.result_size);
    add_field<std::uint64_t>(pyObj, "error_count", cppObj.error_count);
    add_field<std::uint64_t>(pyObj, "processed_objects", cppObj.processed_objects);
    add_field<std::uint64_t>(pyObj, "warning_count", cppObj.warning_count);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::analytics_response::analytics_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::analytics_response::analytics_problem> {
  using analytics_problem = couchbase::core::operations::analytics_response::analytics_problem;

  static inline analytics_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const analytics_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::analytics_response::analytics_meta_data
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::analytics_response::analytics_meta_data> {
  using analytics_meta_data = couchbase::core::operations::analytics_response::analytics_meta_data;

  static inline analytics_meta_data from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const analytics_meta_data& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "request_id", cppObj.request_id);
    add_field<std::string>(pyObj, "client_context_id", cppObj.client_context_id);
    add_field<couchbase::core::operations::analytics_response::analytics_status>(
      pyObj, "status", cppObj.status);
    add_field<couchbase::core::operations::analytics_response::analytics_metrics>(
      pyObj, "metrics", cppObj.metrics);
    add_field<std::optional<std::string>>(pyObj, "signature", cppObj.signature);
    add_field<std::vector<couchbase::core::operations::analytics_response::analytics_problem>>(
      pyObj, "errors", cppObj.errors);
    add_field<std::vector<couchbase::core::operations::analytics_response::analytics_problem>>(
      pyObj, "warnings", cppObj.warnings);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::query_response::query_metrics
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::query_response::query_metrics> {
  using query_metrics = couchbase::core::operations::query_response::query_metrics;

  static inline query_metrics from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_metrics& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::chrono::nanoseconds>(pyObj, "elapsed_time", cppObj.elapsed_time);
    add_field<std::chrono::nanoseconds>(pyObj, "execution_time", cppObj.execution_time);
    add_field<std::uint64_t>(pyObj, "result_count", cppObj.result_count);
    add_field<std::uint64_t>(pyObj, "result_size", cppObj.result_size);
    add_field<std::uint64_t>(pyObj, "sort_count", cppObj.sort_count);
    add_field<std::uint64_t>(pyObj, "mutation_count", cppObj.mutation_count);
    add_field<std::uint64_t>(pyObj, "error_count", cppObj.error_count);
    add_field<std::uint64_t>(pyObj, "warning_count", cppObj.warning_count);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::query_response::query_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::query_response::query_problem> {
  using query_problem = couchbase::core::operations::query_response::query_problem;

  static inline query_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);
    add_field<std::optional<std::uint64_t>>(pyObj, "reason", cppObj.reason);
    add_field<std::optional<bool>>(pyObj, "retry", cppObj.retry);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::query_response::query_meta_data
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::query_response::query_meta_data> {
  using query_meta_data = couchbase::core::operations::query_response::query_meta_data;

  static inline query_meta_data from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_meta_data& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "request_id", cppObj.request_id);
    add_field<std::string>(pyObj, "client_context_id", cppObj.client_context_id);
    add_field<std::string>(pyObj, "status", cppObj.status);
    add_field<std::optional<couchbase::core::operations::query_response::query_metrics>>(
      pyObj, "metrics", cppObj.metrics);
    add_field<std::optional<std::string>>(pyObj, "signature", cppObj.signature);
    add_field<std::optional<std::string>>(pyObj, "profile", cppObj.profile);
    add_field<
      std::optional<std::vector<couchbase::core::operations::query_response::query_problem>>>(
      pyObj, "warnings", cppObj.warnings);
    add_field<
      std::optional<std::vector<couchbase::core::operations::query_response::query_problem>>>(
      pyObj, "errors", cppObj.errors);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_metrics
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_metrics> {
  using search_metrics = couchbase::core::operations::search_response::search_metrics;

  static inline search_metrics from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const search_metrics& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::chrono::nanoseconds>(pyObj, "took", cppObj.took);
    add_field<std::uint64_t>(pyObj, "total_rows", cppObj.total_rows);
    add_field<double>(pyObj, "max_score", cppObj.max_score);
    add_field<std::uint64_t>(pyObj, "success_partition_count", cppObj.success_partition_count);
    add_field<std::uint64_t>(pyObj, "error_partition_count", cppObj.error_partition_count);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_meta_data
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_meta_data> {
  using search_meta_data = couchbase::core::operations::search_response::search_meta_data;

  static inline search_meta_data from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const search_meta_data& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "client_context_id", cppObj.client_context_id);
    add_field<couchbase::core::operations::search_response::search_metrics>(
      pyObj, "metrics", cppObj.metrics);
    add_field<std::map<std::string, std::string>>(pyObj, "errors", cppObj.errors);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_location
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_location> {
  using search_location = couchbase::core::operations::search_response::search_location;

  static inline search_location from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const search_location& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "field", cppObj.field);
    add_field<std::string>(pyObj, "term", cppObj.term);
    add_field<std::uint64_t>(pyObj, "position", cppObj.position);
    add_field<std::uint64_t>(pyObj, "start_offset", cppObj.start_offset);
    add_field<std::uint64_t>(pyObj, "end_offset", cppObj.end_offset);
    add_field<std::optional<std::vector<std::uint64_t>>>(
      pyObj, "array_positions", cppObj.array_positions);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_row
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_row> {
  using search_row = couchbase::core::operations::search_response::search_row;

  static inline search_row from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const search_row& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "index", cppObj.index);
    add_field<std::string>(pyObj, "id", cppObj.id);
    add_field<double>(pyObj, "score", cppObj.score);
    add_field<std::vector<couchbase::core::operations::search_response::search_location>>(
      pyObj, "locations", cppObj.locations);
    add_field<std::map<std::string, std::vector<std::string>>>(
      pyObj, "fragments", cppObj.fragments);
    add_field<std::string>(pyObj, "fields", cppObj.fields);
    add_field<std::string>(pyObj, "explanation", cppObj.explanation);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_facet::term_facet
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_facet::term_facet> {
  using term_facet = couchbase::core::operations::search_response::search_facet::term_facet;

  static inline term_facet from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const term_facet& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "term", cppObj.term);
    add_field<std::uint64_t>(pyObj, "count", cppObj.count);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_facet::date_range_facet
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_facet::date_range_facet> {
  using date_range_facet =
    couchbase::core::operations::search_response::search_facet::date_range_facet;

  static inline date_range_facet from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const date_range_facet& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::uint64_t>(pyObj, "count", cppObj.count);
    add_field<std::optional<std::string>>(pyObj, "start", cppObj.start);
    add_field<std::optional<std::string>>(pyObj, "end", cppObj.end);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_facet::numeric_range_facet
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::search_response::search_facet::numeric_range_facet> {
  using numeric_range_facet =
    couchbase::core::operations::search_response::search_facet::numeric_range_facet;

  static inline numeric_range_facet from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const numeric_range_facet& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::uint64_t>(pyObj, "count", cppObj.count);
    add_field<std::variant<std::monostate, std::uint64_t, double>>(pyObj, "min", cppObj.min);
    add_field<std::variant<std::monostate, std::uint64_t, double>>(pyObj, "max", cppObj.max);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::search_response::search_facet
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::search_response::search_facet> {
  using search_facet = couchbase::core::operations::search_response::search_facet;

  static inline search_facet from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const search_facet& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "field", cppObj.field);
    add_field<std::uint64_t>(pyObj, "total", cppObj.total);
    add_field<std::uint64_t>(pyObj, "missing", cppObj.missing);
    add_field<std::uint64_t>(pyObj, "other", cppObj.other);
    add_field<std::vector<couchbase::core::operations::search_response::search_facet::term_facet>>(
      pyObj, "terms", cppObj.terms);
    add_field<
      std::vector<couchbase::core::operations::search_response::search_facet::date_range_facet>>(
      pyObj, "date_ranges", cppObj.date_ranges);
    add_field<
      std::vector<couchbase::core::operations::search_response::search_facet::numeric_range_facet>>(
      pyObj, "numeric_ranges", cppObj.numeric_ranges);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::document_view_response::meta_data
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::document_view_response::meta_data> {
  using meta_data = couchbase::core::operations::document_view_response::meta_data;

  static inline meta_data from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const meta_data& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::optional<std::uint64_t>>(pyObj, "total_rows", cppObj.total_rows);
    add_field<std::optional<std::string>>(pyObj, "debug_info", cppObj.debug_info);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::document_view_response::row
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::document_view_response::row> {
  using row = couchbase::core::operations::document_view_response::row;

  static inline row from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const row& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::optional<std::string>>(pyObj, "id", cppObj.id);
    add_field<std::string>(pyObj, "key", cppObj.key);
    add_field<std::string>(pyObj, "value", cppObj.value);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::document_view_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::document_view_response::problem> {
  using problem = couchbase::core::operations::document_view_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::analytics_problem> {
  using analytics_problem = couchbase::core::operations::management::analytics_problem;

  static inline analytics_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const analytics_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::dataset
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::dataset> {
  using dataset = couchbase::core::management::analytics::dataset;

  static inline dataset from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const dataset& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "dataverse_name", cppObj.dataverse_name);
    add_field<std::string>(pyObj, "link_name", cppObj.link_name);
    add_field<std::string>(pyObj, "bucket_name", cppObj.bucket_name);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::index
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::index> {
  using index = couchbase::core::management::analytics::index;

  static inline index from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const index& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "dataverse_name", cppObj.dataverse_name);
    add_field<std::string>(pyObj, "dataset_name", cppObj.dataset_name);
    add_field<bool>(pyObj, "is_primary", cppObj.is_primary);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_connect_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_connect_response::problem> {
  using problem = couchbase::core::operations::management::analytics_link_connect_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_create_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_create_response::problem> {
  using problem = couchbase::core::operations::management::analytics_link_create_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_disconnect_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_disconnect_response::problem> {
  using problem =
    couchbase::core::operations::management::analytics_link_disconnect_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_drop_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_drop_response::problem> {
  using problem = couchbase::core::operations::management::analytics_link_drop_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_get_all_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_get_all_response::problem> {
  using problem = couchbase::core::operations::management::analytics_link_get_all_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::couchbase_link_encryption_settings
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::couchbase_link_encryption_settings> {
  using couchbase_link_encryption_settings =
    couchbase::core::management::analytics::couchbase_link_encryption_settings;

  static inline couchbase_link_encryption_settings from_py(PyObject* pyObj)
  {
    couchbase_link_encryption_settings cppObj;

    extract_field<couchbase::core::management::analytics::couchbase_link_encryption_level>(
      pyObj, "level", cppObj.level);
    extract_field<std::optional<std::string>>(pyObj, "certificate", cppObj.certificate);
    extract_field<std::optional<std::string>>(
      pyObj, "client_certificate", cppObj.client_certificate);
    extract_field<std::optional<std::string>>(pyObj, "client_key", cppObj.client_key);
    return cppObj;
  }

  static inline PyObject* to_py(const couchbase_link_encryption_settings& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<couchbase::core::management::analytics::couchbase_link_encryption_level>(
      pyObj, "level", cppObj.level);
    add_field<std::optional<std::string>>(pyObj, "certificate", cppObj.certificate);
    add_field<std::optional<std::string>>(pyObj, "client_certificate", cppObj.client_certificate);
    add_field<std::optional<std::string>>(pyObj, "client_key", cppObj.client_key);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::couchbase_remote_link
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::couchbase_remote_link> {
  using couchbase_remote_link = couchbase::core::management::analytics::couchbase_remote_link;

  static inline couchbase_remote_link from_py(PyObject* pyObj)
  {
    couchbase_remote_link cppObj;

    extract_field<std::string>(pyObj, "link_name", cppObj.link_name);
    extract_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    extract_field<std::string>(pyObj, "hostname", cppObj.hostname);
    extract_field<std::optional<std::string>>(pyObj, "username", cppObj.username);
    extract_field<std::optional<std::string>>(pyObj, "password", cppObj.password);
    extract_field<couchbase::core::management::analytics::couchbase_link_encryption_settings>(
      pyObj, "encryption", cppObj.encryption);
    return cppObj;
  }

  static inline PyObject* to_py(const couchbase_remote_link& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "link_name", cppObj.link_name);
    add_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    add_field<std::string>(pyObj, "hostname", cppObj.hostname);
    add_field<std::optional<std::string>>(pyObj, "username", cppObj.username);
    add_field<std::optional<std::string>>(pyObj, "password", cppObj.password);
    add_field<couchbase::core::management::analytics::couchbase_link_encryption_settings>(
      pyObj, "encryption", cppObj.encryption);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::s3_external_link
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::s3_external_link> {
  using s3_external_link = couchbase::core::management::analytics::s3_external_link;

  static inline s3_external_link from_py(PyObject* pyObj)
  {
    s3_external_link cppObj;

    extract_field<std::string>(pyObj, "link_name", cppObj.link_name);
    extract_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    extract_field<std::string>(pyObj, "access_key_id", cppObj.access_key_id);
    extract_field<std::string>(pyObj, "secret_access_key", cppObj.secret_access_key);
    extract_field<std::optional<std::string>>(pyObj, "session_token", cppObj.session_token);
    extract_field<std::string>(pyObj, "region", cppObj.region);
    extract_field<std::optional<std::string>>(pyObj, "service_endpoint", cppObj.service_endpoint);
    return cppObj;
  }

  static inline PyObject* to_py(const s3_external_link& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "link_name", cppObj.link_name);
    add_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    add_field<std::string>(pyObj, "access_key_id", cppObj.access_key_id);
    add_field<std::string>(pyObj, "secret_access_key", cppObj.secret_access_key);
    add_field<std::optional<std::string>>(pyObj, "session_token", cppObj.session_token);
    add_field<std::string>(pyObj, "region", cppObj.region);
    add_field<std::optional<std::string>>(pyObj, "service_endpoint", cppObj.service_endpoint);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::analytics::azure_blob_external_link
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::analytics::azure_blob_external_link> {
  using azure_blob_external_link = couchbase::core::management::analytics::azure_blob_external_link;

  static inline azure_blob_external_link from_py(PyObject* pyObj)
  {
    azure_blob_external_link cppObj;

    extract_field<std::string>(pyObj, "link_name", cppObj.link_name);
    extract_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    extract_field<std::optional<std::string>>(pyObj, "connection_string", cppObj.connection_string);
    extract_field<std::optional<std::string>>(pyObj, "account_name", cppObj.account_name);
    extract_field<std::optional<std::string>>(pyObj, "account_key", cppObj.account_key);
    extract_field<std::optional<std::string>>(
      pyObj, "shared_access_signature", cppObj.shared_access_signature);
    extract_field<std::optional<std::string>>(pyObj, "blob_endpoint", cppObj.blob_endpoint);
    extract_field<std::optional<std::string>>(pyObj, "endpoint_suffix", cppObj.endpoint_suffix);
    return cppObj;
  }

  static inline PyObject* to_py(const azure_blob_external_link& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "link_name", cppObj.link_name);
    add_field<std::string>(pyObj, "dataverse", cppObj.dataverse);
    add_field<std::optional<std::string>>(pyObj, "connection_string", cppObj.connection_string);
    add_field<std::optional<std::string>>(pyObj, "account_name", cppObj.account_name);
    add_field<std::optional<std::string>>(pyObj, "account_key", cppObj.account_key);
    add_field<std::optional<std::string>>(
      pyObj, "shared_access_signature", cppObj.shared_access_signature);
    add_field<std::optional<std::string>>(pyObj, "blob_endpoint", cppObj.blob_endpoint);
    add_field<std::optional<std::string>>(pyObj, "endpoint_suffix", cppObj.endpoint_suffix);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::analytics_link_replace_response::problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::analytics_link_replace_response::problem> {
  using problem = couchbase::core::operations::management::analytics_link_replace_response::problem;

  static inline problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint32_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::server_node_address
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::server_node_address> {
  using server_node_address = couchbase::core::operations::management::server_node_address;

  static inline server_node_address from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const server_node_address& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "hostname", cppObj.hostname);
    add_field<std::uint16_t>(pyObj, "kv_plain", cppObj.kv_plain);
    add_field<std::uint16_t>(pyObj, "kv_tls", cppObj.kv_tls);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::server_node
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::server_node> {
  using server_node = couchbase::core::operations::management::server_node;

  static inline server_node from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const server_node& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "server_group_name", cppObj.server_group_name);
    add_field<std::size_t>(pyObj, "server_index", cppObj.server_index);
    add_field<couchbase::core::operations::management::server_node_address>(
      pyObj, "default_network", cppObj.default_network);
    add_field<couchbase::core::operations::management::server_node_address>(
      pyObj, "external_network", cppObj.external_network);
    add_field<std::set<std::uint16_t>>(pyObj, "active_vbuckets", cppObj.active_vbuckets);
    add_field<std::set<std::uint16_t>>(pyObj, "replica_vbuckets", cppObj.replica_vbuckets);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::server_group
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::server_group> {
  using server_group = couchbase::core::operations::management::server_group;

  static inline server_group from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const server_group& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::vector<couchbase::core::operations::management::server_node>>(
      pyObj, "nodes", cppObj.nodes);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::bucket_describe_response::bucket_info
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::bucket_describe_response::bucket_info> {
  using bucket_info =
    couchbase::core::operations::management::bucket_describe_response::bucket_info;

  static inline bucket_info from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const bucket_info& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "uuid", cppObj.uuid);
    add_field<std::size_t>(pyObj, "number_of_nodes", cppObj.number_of_nodes);
    add_field<std::size_t>(pyObj, "number_of_replicas", cppObj.number_of_replicas);
    add_field<std::vector<std::string>>(pyObj, "bucket_capabilities", cppObj.bucket_capabilities);
    add_field<std::map<std::string, couchbase::core::operations::management::server_group>>(
      pyObj, "server_groups", cppObj.server_groups);
    add_field<couchbase::core::management::cluster::bucket_storage_backend>(
      pyObj, "storage_backend", cppObj.storage_backend);
    // config_json

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::cluster::bucket_settings::node
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::cluster::bucket_settings::node> {
  using node = couchbase::core::management::cluster::bucket_settings::node;

  static inline node from_py(PyObject* pyObj)
  {
    node cppObj;

    extract_field<std::string>(pyObj, "hostname", cppObj.hostname);
    extract_field<std::string>(pyObj, "status", cppObj.status);
    extract_field<std::string>(pyObj, "version", cppObj.version);
    extract_field<std::vector<std::string>>(pyObj, "services", cppObj.services);
    extract_field<std::map<std::string, std::uint16_t>>(pyObj, "ports", cppObj.ports);
    return cppObj;
  }

  static inline PyObject* to_py(const node& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "hostname", cppObj.hostname);
    add_field<std::string>(pyObj, "status", cppObj.status);
    add_field<std::string>(pyObj, "version", cppObj.version);
    add_field<std::vector<std::string>>(pyObj, "services", cppObj.services);
    add_field<std::map<std::string, std::uint16_t>>(pyObj, "ports", cppObj.ports);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::cluster::bucket_settings
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::cluster::bucket_settings> {
  using bucket_settings = couchbase::core::management::cluster::bucket_settings;

  static inline bucket_settings from_py(PyObject* pyObj)
  {
    bucket_settings cppObj;

    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::string>(pyObj, "uuid", cppObj.uuid);
    extract_field<std::uint64_t>(pyObj, "ram_quota_mb", cppObj.ram_quota_mb);
    extract_field<couchbase::core::management::cluster::bucket_type>(
      pyObj, "bucket_type", cppObj.bucket_type);
    extract_field<std::optional<std::uint32_t>>(pyObj, "max_expiry", cppObj.max_expiry);
    extract_field<couchbase::core::management::cluster::bucket_compression>(
      pyObj, "compression_mode", cppObj.compression_mode);
    extract_field<std::optional<couchbase::durability_level>>(
      pyObj, "minimum_durability_level", cppObj.minimum_durability_level);
    extract_field<std::optional<std::uint32_t>>(pyObj, "num_replicas", cppObj.num_replicas);
    extract_field<std::optional<bool>>(pyObj, "replica_indexes", cppObj.replica_indexes);
    extract_field<std::optional<bool>>(pyObj, "flush_enabled", cppObj.flush_enabled);
    extract_field<couchbase::core::management::cluster::bucket_eviction_policy>(
      pyObj, "eviction_policy", cppObj.eviction_policy);
    extract_field<couchbase::core::management::cluster::bucket_conflict_resolution>(
      pyObj, "conflict_resolution_type", cppObj.conflict_resolution_type);
    extract_field<std::optional<bool>>(
      pyObj, "history_retention_collection_default", cppObj.history_retention_collection_default);
    extract_field<std::optional<std::uint32_t>>(
      pyObj, "history_retention_bytes", cppObj.history_retention_bytes);
    extract_field<std::optional<std::uint32_t>>(
      pyObj, "history_retention_duration", cppObj.history_retention_duration);
    extract_field<std::optional<std::uint16_t>>(pyObj, "num_vbuckets", cppObj.num_vbuckets);
    extract_field<couchbase::core::management::cluster::bucket_storage_backend>(
      pyObj, "storage_backend", cppObj.storage_backend);
    extract_field<std::vector<std::string>>(pyObj, "capabilities", cppObj.capabilities);
    extract_field<std::vector<couchbase::core::management::cluster::bucket_settings::node>>(
      pyObj, "nodes", cppObj.nodes);
    return cppObj;
  }

  static inline PyObject* to_py(const bucket_settings& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "uuid", cppObj.uuid);
    add_field<std::uint64_t>(pyObj, "ram_quota_mb", cppObj.ram_quota_mb);
    add_field<couchbase::core::management::cluster::bucket_type>(
      pyObj, "bucket_type", cppObj.bucket_type);
    add_field<std::optional<std::uint32_t>>(pyObj, "max_expiry", cppObj.max_expiry);
    add_field<couchbase::core::management::cluster::bucket_compression>(
      pyObj, "compression_mode", cppObj.compression_mode);
    add_field<std::optional<couchbase::durability_level>>(
      pyObj, "minimum_durability_level", cppObj.minimum_durability_level);
    add_field<std::optional<std::uint32_t>>(pyObj, "num_replicas", cppObj.num_replicas);
    add_field<std::optional<bool>>(pyObj, "replica_indexes", cppObj.replica_indexes);
    add_field<std::optional<bool>>(pyObj, "flush_enabled", cppObj.flush_enabled);
    add_field<couchbase::core::management::cluster::bucket_eviction_policy>(
      pyObj, "eviction_policy", cppObj.eviction_policy);
    add_field<couchbase::core::management::cluster::bucket_conflict_resolution>(
      pyObj, "conflict_resolution_type", cppObj.conflict_resolution_type);
    add_field<std::optional<bool>>(
      pyObj, "history_retention_collection_default", cppObj.history_retention_collection_default);
    add_field<std::optional<std::uint32_t>>(
      pyObj, "history_retention_bytes", cppObj.history_retention_bytes);
    add_field<std::optional<std::uint32_t>>(
      pyObj, "history_retention_duration", cppObj.history_retention_duration);
    add_field<std::optional<std::uint16_t>>(pyObj, "num_vbuckets", cppObj.num_vbuckets);
    add_field<couchbase::core::management::cluster::bucket_storage_backend>(
      pyObj, "storage_backend", cppObj.storage_backend);
    add_field<std::vector<std::string>>(pyObj, "capabilities", cppObj.capabilities);
    add_field<std::vector<couchbase::core::management::cluster::bucket_settings::node>>(
      pyObj, "nodes", cppObj.nodes);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::cluster_describe_response::cluster_info::bucket
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::cluster_describe_response::cluster_info::bucket> {
  using bucket =
    couchbase::core::operations::management::cluster_describe_response::cluster_info::bucket;

  static inline bucket from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const bucket& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "uuid", cppObj.uuid);
    add_field<std::string>(pyObj, "name", cppObj.name);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::cluster_describe_response::cluster_info::node
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::cluster_describe_response::cluster_info::node> {
  using node =
    couchbase::core::operations::management::cluster_describe_response::cluster_info::node;

  static inline node from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const node& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "uuid", cppObj.uuid);
    add_field<std::string>(pyObj, "otp_node", cppObj.otp_node);
    add_field<std::string>(pyObj, "status", cppObj.status);
    add_field<std::string>(pyObj, "hostname", cppObj.hostname);
    add_field<std::string>(pyObj, "os", cppObj.os);
    add_field<std::string>(pyObj, "version", cppObj.version);
    add_field<std::vector<std::string>>(pyObj, "services", cppObj.services);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::cluster_describe_response::cluster_info
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::cluster_describe_response::cluster_info> {
  using cluster_info =
    couchbase::core::operations::management::cluster_describe_response::cluster_info;

  static inline cluster_info from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const cluster_info& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<
      couchbase::core::operations::management::cluster_describe_response::cluster_info::node>>(
      pyObj, "nodes", cppObj.nodes);
    add_field<std::vector<
      couchbase::core::operations::management::cluster_describe_response::cluster_info::bucket>>(
      pyObj, "buckets", cppObj.buckets);
    add_field<std::set<couchbase::core::service_type>>(pyObj, "services", cppObj.services);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::topology::collections_manifest::collection
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::topology::collections_manifest::collection> {
  using collection = couchbase::core::topology::collections_manifest::collection;

  static inline collection from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const collection& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "uid", cppObj.uid);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::int32_t>(pyObj, "max_expiry", cppObj.max_expiry);
    add_field<std::optional<bool>>(pyObj, "history", cppObj.history);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::topology::collections_manifest::scope
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::topology::collections_manifest::scope> {
  using scope = couchbase::core::topology::collections_manifest::scope;

  static inline scope from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const scope& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "uid", cppObj.uid);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::vector<couchbase::core::topology::collections_manifest::collection>>(
      pyObj, "collections", cppObj.collections);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::topology::collections_manifest
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::topology::collections_manifest> {
  using collections_manifest = couchbase::core::topology::collections_manifest;

  static inline collections_manifest from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const collections_manifest& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::array<std::uint8_t, 16>>(pyObj, "id", cppObj.id);
    add_field<std::uint64_t>(pyObj, "uid", cppObj.uid);
    add_field<std::vector<couchbase::core::topology::collections_manifest::scope>>(
      pyObj, "scopes", cppObj.scopes);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::eventing_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::operations::management::eventing_problem> {
  using eventing_problem = couchbase::core::operations::management::eventing_problem;

  static inline eventing_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const eventing_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "description", cppObj.description);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_keyspace
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_keyspace> {
  using function_keyspace = couchbase::core::management::eventing::function_keyspace;

  static inline function_keyspace from_py(PyObject* pyObj)
  {
    function_keyspace cppObj;

    extract_field<std::string>(pyObj, "bucket", cppObj.bucket);
    extract_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    extract_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);
    return cppObj;
  }

  static inline PyObject* to_py(const function_keyspace& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    add_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_settings
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_settings> {
  using function_settings = couchbase::core::management::eventing::function_settings;

  static inline function_settings from_py(PyObject* pyObj)
  {
    function_settings cppObj;

    extract_field<std::optional<std::int64_t>>(pyObj, "cpp_worker_count", cppObj.cpp_worker_count);
    extract_field<std::optional<couchbase::core::management::eventing::function_dcp_boundary>>(
      pyObj, "dcp_stream_boundary", cppObj.dcp_stream_boundary);
    extract_field<std::optional<std::string>>(pyObj, "description", cppObj.description);
    extract_field<std::optional<couchbase::core::management::eventing::function_deployment_status>>(
      pyObj, "deployment_status", cppObj.deployment_status);
    extract_field<std::optional<couchbase::core::management::eventing::function_processing_status>>(
      pyObj, "processing_status", cppObj.processing_status);
    extract_field<std::optional<couchbase::core::management::eventing::function_log_level>>(
      pyObj, "log_level", cppObj.log_level);
    extract_field<
      std::optional<couchbase::core::management::eventing::function_language_compatibility>>(
      pyObj, "language_compatibility", cppObj.language_compatibility);
    extract_field<std::optional<std::chrono::seconds>>(
      pyObj, "execution_timeout", cppObj.execution_timeout);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "lcb_inst_capacity", cppObj.lcb_inst_capacity);
    extract_field<std::optional<std::int64_t>>(pyObj, "lcb_retry_count", cppObj.lcb_retry_count);
    extract_field<std::optional<std::chrono::seconds>>(pyObj, "lcb_timeout", cppObj.lcb_timeout);
    extract_field<std::optional<couchbase::query_scan_consistency>>(
      pyObj, "query_consistency", cppObj.query_consistency);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "num_timer_partitions", cppObj.num_timer_partitions);
    extract_field<std::optional<std::int64_t>>(pyObj, "sock_batch_size", cppObj.sock_batch_size);
    extract_field<std::optional<std::chrono::milliseconds>>(
      pyObj, "tick_duration", cppObj.tick_duration);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "timer_context_size", cppObj.timer_context_size);
    extract_field<std::optional<std::string>>(pyObj, "user_prefix", cppObj.user_prefix);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "bucket_cache_size", cppObj.bucket_cache_size);
    extract_field<std::optional<std::chrono::milliseconds>>(
      pyObj, "bucket_cache_age", cppObj.bucket_cache_age);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "curl_max_allowed_resp_size", cppObj.curl_max_allowed_resp_size);
    extract_field<std::optional<bool>>(pyObj, "query_prepare_all", cppObj.query_prepare_all);
    extract_field<std::optional<std::int64_t>>(pyObj, "worker_count", cppObj.worker_count);
    extract_field<std::vector<std::string>>(pyObj, "handler_headers", cppObj.handler_headers);
    extract_field<std::vector<std::string>>(pyObj, "handler_footers", cppObj.handler_footers);
    extract_field<std::optional<bool>>(
      pyObj, "enable_app_log_rotation", cppObj.enable_app_log_rotation);
    extract_field<std::optional<std::string>>(pyObj, "app_log_dir", cppObj.app_log_dir);
    extract_field<std::optional<std::int64_t>>(pyObj, "app_log_max_size", cppObj.app_log_max_size);
    extract_field<std::optional<std::int64_t>>(
      pyObj, "app_log_max_files", cppObj.app_log_max_files);
    extract_field<std::optional<std::chrono::seconds>>(
      pyObj, "checkpoint_interval", cppObj.checkpoint_interval);
    return cppObj;
  }

  static inline PyObject* to_py(const function_settings& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::optional<std::int64_t>>(pyObj, "cpp_worker_count", cppObj.cpp_worker_count);
    add_field<std::optional<couchbase::core::management::eventing::function_dcp_boundary>>(
      pyObj, "dcp_stream_boundary", cppObj.dcp_stream_boundary);
    add_field<std::optional<std::string>>(pyObj, "description", cppObj.description);
    add_field<std::optional<couchbase::core::management::eventing::function_deployment_status>>(
      pyObj, "deployment_status", cppObj.deployment_status);
    add_field<std::optional<couchbase::core::management::eventing::function_processing_status>>(
      pyObj, "processing_status", cppObj.processing_status);
    add_field<std::optional<couchbase::core::management::eventing::function_log_level>>(
      pyObj, "log_level", cppObj.log_level);
    add_field<
      std::optional<couchbase::core::management::eventing::function_language_compatibility>>(
      pyObj, "language_compatibility", cppObj.language_compatibility);
    add_field<std::optional<std::chrono::seconds>>(
      pyObj, "execution_timeout", cppObj.execution_timeout);
    add_field<std::optional<std::int64_t>>(pyObj, "lcb_inst_capacity", cppObj.lcb_inst_capacity);
    add_field<std::optional<std::int64_t>>(pyObj, "lcb_retry_count", cppObj.lcb_retry_count);
    add_field<std::optional<std::chrono::seconds>>(pyObj, "lcb_timeout", cppObj.lcb_timeout);
    add_field<std::optional<couchbase::query_scan_consistency>>(
      pyObj, "query_consistency", cppObj.query_consistency);
    add_field<std::optional<std::int64_t>>(
      pyObj, "num_timer_partitions", cppObj.num_timer_partitions);
    add_field<std::optional<std::int64_t>>(pyObj, "sock_batch_size", cppObj.sock_batch_size);
    add_field<std::optional<std::chrono::milliseconds>>(
      pyObj, "tick_duration", cppObj.tick_duration);
    add_field<std::optional<std::int64_t>>(pyObj, "timer_context_size", cppObj.timer_context_size);
    add_field<std::optional<std::string>>(pyObj, "user_prefix", cppObj.user_prefix);
    add_field<std::optional<std::int64_t>>(pyObj, "bucket_cache_size", cppObj.bucket_cache_size);
    add_field<std::optional<std::chrono::milliseconds>>(
      pyObj, "bucket_cache_age", cppObj.bucket_cache_age);
    add_field<std::optional<std::int64_t>>(
      pyObj, "curl_max_allowed_resp_size", cppObj.curl_max_allowed_resp_size);
    add_field<std::optional<bool>>(pyObj, "query_prepare_all", cppObj.query_prepare_all);
    add_field<std::optional<std::int64_t>>(pyObj, "worker_count", cppObj.worker_count);
    add_field<std::vector<std::string>>(pyObj, "handler_headers", cppObj.handler_headers);
    add_field<std::vector<std::string>>(pyObj, "handler_footers", cppObj.handler_footers);
    add_field<std::optional<bool>>(
      pyObj, "enable_app_log_rotation", cppObj.enable_app_log_rotation);
    add_field<std::optional<std::string>>(pyObj, "app_log_dir", cppObj.app_log_dir);
    add_field<std::optional<std::int64_t>>(pyObj, "app_log_max_size", cppObj.app_log_max_size);
    add_field<std::optional<std::int64_t>>(pyObj, "app_log_max_files", cppObj.app_log_max_files);
    add_field<std::optional<std::chrono::seconds>>(
      pyObj, "checkpoint_interval", cppObj.checkpoint_interval);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_bucket_binding
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_bucket_binding> {
  using function_bucket_binding = couchbase::core::management::eventing::function_bucket_binding;

  static inline function_bucket_binding from_py(PyObject* pyObj)
  {
    function_bucket_binding cppObj;

    extract_field<std::string>(pyObj, "alias", cppObj.alias);
    extract_field<couchbase::core::management::eventing::function_keyspace>(
      pyObj, "name", cppObj.name);
    extract_field<couchbase::core::management::eventing::function_bucket_access>(
      pyObj, "access", cppObj.access);
    return cppObj;
  }

  static inline PyObject* to_py(const function_bucket_binding& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "alias", cppObj.alias);
    add_field<couchbase::core::management::eventing::function_keyspace>(pyObj, "name", cppObj.name);
    add_field<couchbase::core::management::eventing::function_bucket_access>(
      pyObj, "access", cppObj.access);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_url_no_auth
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_url_no_auth> {
  using function_url_no_auth = couchbase::core::management::eventing::function_url_no_auth;

  static inline function_url_no_auth from_py(PyObject* pyObj)
  {
    function_url_no_auth cppObj;

    return cppObj;
  }

  static inline PyObject* to_py(const function_url_no_auth& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_url_auth_basic
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_url_auth_basic> {
  using function_url_auth_basic = couchbase::core::management::eventing::function_url_auth_basic;

  static inline function_url_auth_basic from_py(PyObject* pyObj)
  {
    function_url_auth_basic cppObj;

    extract_field<std::string>(pyObj, "username", cppObj.username);
    extract_field<std::string>(pyObj, "password", cppObj.password);
    return cppObj;
  }

  static inline PyObject* to_py(const function_url_auth_basic& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "username", cppObj.username);
    add_field<std::string>(pyObj, "password", cppObj.password);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_url_auth_digest
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_url_auth_digest> {
  using function_url_auth_digest = couchbase::core::management::eventing::function_url_auth_digest;

  static inline function_url_auth_digest from_py(PyObject* pyObj)
  {
    function_url_auth_digest cppObj;

    extract_field<std::string>(pyObj, "username", cppObj.username);
    extract_field<std::string>(pyObj, "password", cppObj.password);
    return cppObj;
  }

  static inline PyObject* to_py(const function_url_auth_digest& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "username", cppObj.username);
    add_field<std::string>(pyObj, "password", cppObj.password);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_url_auth_bearer
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_url_auth_bearer> {
  using function_url_auth_bearer = couchbase::core::management::eventing::function_url_auth_bearer;

  static inline function_url_auth_bearer from_py(PyObject* pyObj)
  {
    function_url_auth_bearer cppObj;

    extract_field<std::string>(pyObj, "key", cppObj.key);
    return cppObj;
  }

  static inline PyObject* to_py(const function_url_auth_bearer& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "key", cppObj.key);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_url_binding
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_url_binding> {
  using function_url_binding = couchbase::core::management::eventing::function_url_binding;

  static inline function_url_binding from_py(PyObject* pyObj)
  {
    function_url_binding cppObj;

    extract_field<std::string>(pyObj, "alias", cppObj.alias);
    extract_field<std::string>(pyObj, "hostname", cppObj.hostname);
    extract_field<bool>(pyObj, "allow_cookies", cppObj.allow_cookies);
    extract_field<bool>(pyObj, "validate_ssl_certificate", cppObj.validate_ssl_certificate);
    extract_field<std::variant<couchbase::core::management::eventing::function_url_no_auth,
                               couchbase::core::management::eventing::function_url_auth_basic,
                               couchbase::core::management::eventing::function_url_auth_digest,
                               couchbase::core::management::eventing::function_url_auth_bearer>>(
      pyObj, "auth", cppObj.auth);
    return cppObj;
  }

  static inline PyObject* to_py(const function_url_binding& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "alias", cppObj.alias);
    add_field<std::string>(pyObj, "hostname", cppObj.hostname);
    add_field<bool>(pyObj, "allow_cookies", cppObj.allow_cookies);
    add_field<bool>(pyObj, "validate_ssl_certificate", cppObj.validate_ssl_certificate);
    add_field<std::variant<couchbase::core::management::eventing::function_url_no_auth,
                           couchbase::core::management::eventing::function_url_auth_basic,
                           couchbase::core::management::eventing::function_url_auth_digest,
                           couchbase::core::management::eventing::function_url_auth_bearer>>(
      pyObj, "auth", cppObj.auth);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_constant_binding
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_constant_binding> {
  using function_constant_binding =
    couchbase::core::management::eventing::function_constant_binding;

  static inline function_constant_binding from_py(PyObject* pyObj)
  {
    function_constant_binding cppObj;

    extract_field<std::string>(pyObj, "alias", cppObj.alias);
    extract_field<std::string>(pyObj, "literal", cppObj.literal);
    return cppObj;
  }

  static inline PyObject* to_py(const function_constant_binding& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "alias", cppObj.alias);
    add_field<std::string>(pyObj, "literal", cppObj.literal);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function> {
  using function = couchbase::core::management::eventing::function;

  static inline function from_py(PyObject* pyObj)
  {
    function cppObj;

    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::string>(pyObj, "code", cppObj.code);
    extract_field<couchbase::core::management::eventing::function_keyspace>(
      pyObj, "metadata_keyspace", cppObj.metadata_keyspace);
    extract_field<couchbase::core::management::eventing::function_keyspace>(
      pyObj, "source_keyspace", cppObj.source_keyspace);
    extract_field<std::optional<std::string>>(pyObj, "version", cppObj.version);
    extract_field<std::optional<bool>>(pyObj, "enforce_schema", cppObj.enforce_schema);
    extract_field<std::optional<std::int64_t>>(pyObj, "handler_uuid", cppObj.handler_uuid);
    extract_field<std::optional<std::string>>(
      pyObj, "function_instance_id", cppObj.function_instance_id);
    extract_field<std::vector<couchbase::core::management::eventing::function_bucket_binding>>(
      pyObj, "bucket_bindings", cppObj.bucket_bindings);
    extract_field<std::vector<couchbase::core::management::eventing::function_url_binding>>(
      pyObj, "url_bindings", cppObj.url_bindings);
    extract_field<std::vector<couchbase::core::management::eventing::function_constant_binding>>(
      pyObj, "constant_bindings", cppObj.constant_bindings);
    extract_field<couchbase::core::management::eventing::function_settings>(
      pyObj, "settings", cppObj.settings);
    // internal
    return cppObj;
  }

  static inline PyObject* to_py(const function& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "code", cppObj.code);
    add_field<couchbase::core::management::eventing::function_keyspace>(
      pyObj, "metadata_keyspace", cppObj.metadata_keyspace);
    add_field<couchbase::core::management::eventing::function_keyspace>(
      pyObj, "source_keyspace", cppObj.source_keyspace);
    add_field<std::optional<std::string>>(pyObj, "version", cppObj.version);
    add_field<std::optional<bool>>(pyObj, "enforce_schema", cppObj.enforce_schema);
    add_field<std::optional<std::int64_t>>(pyObj, "handler_uuid", cppObj.handler_uuid);
    add_field<std::optional<std::string>>(
      pyObj, "function_instance_id", cppObj.function_instance_id);
    add_field<std::vector<couchbase::core::management::eventing::function_bucket_binding>>(
      pyObj, "bucket_bindings", cppObj.bucket_bindings);
    add_field<std::vector<couchbase::core::management::eventing::function_url_binding>>(
      pyObj, "url_bindings", cppObj.url_bindings);
    add_field<std::vector<couchbase::core::management::eventing::function_constant_binding>>(
      pyObj, "constant_bindings", cppObj.constant_bindings);
    add_field<couchbase::core::management::eventing::function_settings>(
      pyObj, "settings", cppObj.settings);
    // internal

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::function_state
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::function_state> {
  using function_state = couchbase::core::management::eventing::function_state;

  static inline function_state from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const function_state& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<couchbase::core::management::eventing::function_status>(
      pyObj, "status", cppObj.status);
    add_field<std::uint64_t>(pyObj, "num_bootstrapping_nodes", cppObj.num_bootstrapping_nodes);
    add_field<std::uint64_t>(pyObj, "num_deployed_nodes", cppObj.num_deployed_nodes);
    add_field<couchbase::core::management::eventing::function_deployment_status>(
      pyObj, "deployment_status", cppObj.deployment_status);
    add_field<couchbase::core::management::eventing::function_processing_status>(
      pyObj, "processing_status", cppObj.processing_status);
    add_field<std::optional<bool>>(pyObj, "redeploy_required", cppObj.redeploy_required);
    // internal

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::eventing::status
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::eventing::status> {
  using status = couchbase::core::management::eventing::status;

  static inline status from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const status& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "num_eventing_nodes", cppObj.num_eventing_nodes);
    add_field<std::vector<couchbase::core::management::eventing::function_state>>(
      pyObj, "functions", cppObj.functions);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::query_index_create_response::query_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::query_index_create_response::query_problem> {
  using query_problem =
    couchbase::core::operations::management::query_index_create_response::query_problem;

  static inline query_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::query_index_build_response::query_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::query_index_build_response::query_problem> {
  using query_problem =
    couchbase::core::operations::management::query_index_build_response::query_problem;

  static inline query_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::query_index_build_deferred_response::query_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::query_index_build_deferred_response::query_problem> {
  using query_problem =
    couchbase::core::operations::management::query_index_build_deferred_response::query_problem;

  static inline query_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::operations::management::query_index_drop_response::query_problem
// ==========================================================================================
template<>
struct py_to_cbpp_t<
  couchbase::core::operations::management::query_index_drop_response::query_problem> {
  using query_problem =
    couchbase::core::operations::management::query_index_drop_response::query_problem;

  static inline query_problem from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_problem& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::uint64_t>(pyObj, "code", cppObj.code);
    add_field<std::string>(pyObj, "message", cppObj.message);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::management::query_index
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::management::query_index> {
  using query_index = couchbase::management::query_index;

  static inline query_index from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const query_index& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<bool>(pyObj, "is_primary", cppObj.is_primary);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "state", cppObj.state);
    add_field<std::string>(pyObj, "type", cppObj.type);
    add_field<std::vector<std::string>>(pyObj, "index_key", cppObj.index_key);
    add_field<std::optional<std::string>>(pyObj, "partition", cppObj.partition);
    add_field<std::optional<std::string>>(pyObj, "condition", cppObj.condition);
    add_field<std::string>(pyObj, "bucket_name", cppObj.bucket_name);
    add_field<std::optional<std::string>>(pyObj, "scope_name", cppObj.scope_name);
    add_field<std::optional<std::string>>(pyObj, "collection_name", cppObj.collection_name);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::search::index
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::search::index> {
  using index = couchbase::core::management::search::index;

  static inline index from_py(PyObject* pyObj)
  {
    index cppObj;

    extract_field<std::string>(pyObj, "uuid", cppObj.uuid);
    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::string>(pyObj, "type", cppObj.type);
    extract_field<std::string>(pyObj, "params_json", cppObj.params_json);
    extract_field<std::string>(pyObj, "source_uuid", cppObj.source_uuid);
    extract_field<std::string>(pyObj, "source_name", cppObj.source_name);
    extract_field<std::string>(pyObj, "source_type", cppObj.source_type);
    extract_field<std::string>(pyObj, "source_params_json", cppObj.source_params_json);
    extract_field<std::string>(pyObj, "plan_params_json", cppObj.plan_params_json);
    return cppObj;
  }

  static inline PyObject* to_py(const index& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "uuid", cppObj.uuid);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::string>(pyObj, "type", cppObj.type);
    add_field<std::string>(pyObj, "params_json", cppObj.params_json);
    add_field<std::string>(pyObj, "source_uuid", cppObj.source_uuid);
    add_field<std::string>(pyObj, "source_name", cppObj.source_name);
    add_field<std::string>(pyObj, "source_type", cppObj.source_type);
    add_field<std::string>(pyObj, "source_params_json", cppObj.source_params_json);
    add_field<std::string>(pyObj, "plan_params_json", cppObj.plan_params_json);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::role
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::role> {
  using role = couchbase::core::management::rbac::role;

  static inline role from_py(PyObject* pyObj)
  {
    role cppObj;

    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    extract_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    extract_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);
    return cppObj;
  }

  static inline PyObject* to_py(const role& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    add_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::role_and_description
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::role_and_description> {
  using role_and_description = couchbase::core::management::rbac::role_and_description;

  static inline role_and_description from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const role_and_description& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "display_name", cppObj.display_name);
    add_field<std::string>(pyObj, "description", cppObj.description);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    add_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::origin
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::origin> {
  using origin = couchbase::core::management::rbac::origin;

  static inline origin from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const origin& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "type", cppObj.type);
    add_field<std::optional<std::string>>(pyObj, "name", cppObj.name);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::role_and_origins
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::role_and_origins> {
  using role_and_origins = couchbase::core::management::rbac::role_and_origins;

  static inline role_and_origins from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const role_and_origins& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::vector<couchbase::core::management::rbac::origin>>(
      pyObj, "origins", cppObj.origins);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::optional<std::string>>(pyObj, "bucket", cppObj.bucket);
    add_field<std::optional<std::string>>(pyObj, "scope", cppObj.scope);
    add_field<std::optional<std::string>>(pyObj, "collection", cppObj.collection);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::user
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::user> {
  using user = couchbase::core::management::rbac::user;

  static inline user from_py(PyObject* pyObj)
  {
    user cppObj;

    extract_field<std::string>(pyObj, "username", cppObj.username);
    extract_field<std::optional<std::string>>(pyObj, "display_name", cppObj.display_name);
    extract_field<std::set<std::string>>(pyObj, "groups", cppObj.groups);
    extract_field<std::vector<couchbase::core::management::rbac::role>>(
      pyObj, "roles", cppObj.roles);
    extract_field<std::optional<std::string>>(pyObj, "password", cppObj.password);
    return cppObj;
  }

  static inline PyObject* to_py(const user& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "username", cppObj.username);
    add_field<std::optional<std::string>>(pyObj, "display_name", cppObj.display_name);
    add_field<std::set<std::string>>(pyObj, "groups", cppObj.groups);
    add_field<std::vector<couchbase::core::management::rbac::role>>(pyObj, "roles", cppObj.roles);
    add_field<std::optional<std::string>>(pyObj, "password", cppObj.password);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::user_and_metadata
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::user_and_metadata> {
  using user_and_metadata = couchbase::core::management::rbac::user_and_metadata;

  static inline user_and_metadata from_py(PyObject* pyObj)
  {
    return {};
  }

  static inline PyObject* to_py(const user_and_metadata& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<couchbase::core::management::rbac::auth_domain>(pyObj, "domain", cppObj.domain);
    add_field<std::vector<couchbase::core::management::rbac::role_and_origins>>(
      pyObj, "effective_roles", cppObj.effective_roles);
    add_field<std::optional<std::string>>(pyObj, "password_changed", cppObj.password_changed);
    add_field<std::set<std::string>>(pyObj, "external_groups", cppObj.external_groups);
    add_field<std::string>(pyObj, "username", cppObj.username);
    add_field<std::optional<std::string>>(pyObj, "display_name", cppObj.display_name);
    add_field<std::set<std::string>>(pyObj, "groups", cppObj.groups);
    add_field<std::vector<couchbase::core::management::rbac::role>>(pyObj, "roles", cppObj.roles);
    add_field<std::optional<std::string>>(pyObj, "password", cppObj.password);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::rbac::group
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::rbac::group> {
  using group = couchbase::core::management::rbac::group;

  static inline group from_py(PyObject* pyObj)
  {
    group cppObj;

    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::optional<std::string>>(pyObj, "description", cppObj.description);
    extract_field<std::vector<couchbase::core::management::rbac::role>>(
      pyObj, "roles", cppObj.roles);
    extract_field<std::optional<std::string>>(
      pyObj, "ldap_group_reference", cppObj.ldap_group_reference);
    return cppObj;
  }

  static inline PyObject* to_py(const group& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::optional<std::string>>(pyObj, "description", cppObj.description);
    add_field<std::vector<couchbase::core::management::rbac::role>>(pyObj, "roles", cppObj.roles);
    add_field<std::optional<std::string>>(
      pyObj, "ldap_group_reference", cppObj.ldap_group_reference);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::views::design_document::view
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::views::design_document::view> {
  using view = couchbase::core::management::views::design_document::view;

  static inline view from_py(PyObject* pyObj)
  {
    view cppObj;

    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<std::optional<std::string>>(pyObj, "map", cppObj.map);
    extract_field<std::optional<std::string>>(pyObj, "reduce", cppObj.reduce);
    return cppObj;
  }

  static inline PyObject* to_py(const view& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<std::optional<std::string>>(pyObj, "map", cppObj.map);
    add_field<std::optional<std::string>>(pyObj, "reduce", cppObj.reduce);

    return pyObj;
  }
};

// ==========================================================================================
// couchbase::core::management::views::design_document
// ==========================================================================================
template<>
struct py_to_cbpp_t<couchbase::core::management::views::design_document> {
  using design_document = couchbase::core::management::views::design_document;

  static inline design_document from_py(PyObject* pyObj)
  {
    design_document cppObj;

    extract_field<std::optional<std::string>>(pyObj, "rev", cppObj.rev);
    extract_field<std::string>(pyObj, "name", cppObj.name);
    extract_field<couchbase::core::design_document_namespace>(pyObj, "ns", cppObj.ns);
    extract_field<std::map<std::string, couchbase::core::management::views::design_document::view>>(
      pyObj, "views", cppObj.views);
    return cppObj;
  }

  static inline PyObject* to_py(const design_document& cppObj)
  {
    PyObject* pyObj = PyDict_New();
    if (pyObj == nullptr) {
      return nullptr;
    }

    add_field<std::optional<std::string>>(pyObj, "rev", cppObj.rev);
    add_field<std::string>(pyObj, "name", cppObj.name);
    add_field<couchbase::core::design_document_namespace>(pyObj, "ns", cppObj.ns);
    add_field<std::map<std::string, couchbase::core::management::views::design_document::view>>(
      pyObj, "views", cppObj.views);

    return pyObj;
  }
};

} // namespace pycbc

// ====================================================================================================
// AUTOGENERATED FILE END - DO NOT EDIT MANUALLY
// Generated-On: 2026-02-25 14:23:36
// ====================================================================================================
