/*
 * Copyright 2022 Google LLC
 *
 * 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.
 */

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: firestore/bundle.proto

#include "firestore/bundle.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
extern PROTOBUF_INTERNAL_EXPORT_firestore_2fbundle_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundleMetadata_firestore_2fbundle_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_firestore_2fbundle_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_firestore_2fbundle_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundledQuery_firestore_2fbundle_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_firestore_2fbundle_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_NamedQuery_firestore_2fbundle_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fv1_2fdocument_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_Document_google_2ffirestore_2fv1_2fdocument_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_google_2ffirestore_2fv1_2fquery_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<6> scc_info_StructuredQuery_google_2ffirestore_2fv1_2fquery_2eproto;
extern PROTOBUF_INTERNAL_EXPORT_google_2fprotobuf_2ftimestamp_2eproto ::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<0> scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto;
namespace firestore {
class BundledQueryDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<BundledQuery> _instance;
  const ::google::firestore::v1::StructuredQuery* structured_query_;
} _BundledQuery_default_instance_;
class NamedQueryDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<NamedQuery> _instance;
} _NamedQuery_default_instance_;
class BundledDocumentMetadataDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<BundledDocumentMetadata> _instance;
} _BundledDocumentMetadata_default_instance_;
class BundleMetadataDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<BundleMetadata> _instance;
} _BundleMetadata_default_instance_;
class BundleElementDefaultTypeInternal {
 public:
  ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<BundleElement> _instance;
  const ::firestore::BundleMetadata* metadata_;
  const ::firestore::NamedQuery* named_query_;
  const ::firestore::BundledDocumentMetadata* document_metadata_;
  const ::google::firestore::v1::Document* document_;
} _BundleElement_default_instance_;
}  // namespace firestore
static void InitDefaultsscc_info_BundleElement_firestore_2fbundle_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::firestore::_BundleElement_default_instance_;
    new (ptr) ::firestore::BundleElement();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::firestore::BundleElement::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<4> scc_info_BundleElement_firestore_2fbundle_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 4, 0, InitDefaultsscc_info_BundleElement_firestore_2fbundle_2eproto}, {
      &scc_info_BundleMetadata_firestore_2fbundle_2eproto.base,
      &scc_info_NamedQuery_firestore_2fbundle_2eproto.base,
      &scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto.base,
      &scc_info_Document_google_2ffirestore_2fv1_2fdocument_2eproto.base,}};

static void InitDefaultsscc_info_BundleMetadata_firestore_2fbundle_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::firestore::_BundleMetadata_default_instance_;
    new (ptr) ::firestore::BundleMetadata();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::firestore::BundleMetadata::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundleMetadata_firestore_2fbundle_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_BundleMetadata_firestore_2fbundle_2eproto}, {
      &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}};

static void InitDefaultsscc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::firestore::_BundledDocumentMetadata_default_instance_;
    new (ptr) ::firestore::BundledDocumentMetadata();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::firestore::BundledDocumentMetadata::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto}, {
      &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}};

static void InitDefaultsscc_info_BundledQuery_firestore_2fbundle_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::firestore::_BundledQuery_default_instance_;
    new (ptr) ::firestore::BundledQuery();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::firestore::BundledQuery::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<1> scc_info_BundledQuery_firestore_2fbundle_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 1, 0, InitDefaultsscc_info_BundledQuery_firestore_2fbundle_2eproto}, {
      &scc_info_StructuredQuery_google_2ffirestore_2fv1_2fquery_2eproto.base,}};

static void InitDefaultsscc_info_NamedQuery_firestore_2fbundle_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::firestore::_NamedQuery_default_instance_;
    new (ptr) ::firestore::NamedQuery();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::firestore::NamedQuery::InitAsDefaultInstance();
}

::PROTOBUF_NAMESPACE_ID::internal::SCCInfo<2> scc_info_NamedQuery_firestore_2fbundle_2eproto =
    {{ATOMIC_VAR_INIT(::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase::kUninitialized), 2, 0, InitDefaultsscc_info_NamedQuery_firestore_2fbundle_2eproto}, {
      &scc_info_BundledQuery_firestore_2fbundle_2eproto.base,
      &scc_info_Timestamp_google_2fprotobuf_2ftimestamp_2eproto.base,}};

static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_firestore_2fbundle_2eproto[5];
static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_firestore_2fbundle_2eproto[1];
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_firestore_2fbundle_2eproto = nullptr;

const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_firestore_2fbundle_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::firestore::BundledQuery, _internal_metadata_),
  ~0u,  // no _extensions_
  PROTOBUF_FIELD_OFFSET(::firestore::BundledQuery, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::firestore::BundledQuery, parent_),
  offsetof(::firestore::BundledQueryDefaultTypeInternal, structured_query_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundledQuery, limit_type_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundledQuery, query_type_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::firestore::NamedQuery, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::firestore::NamedQuery, name_),
  PROTOBUF_FIELD_OFFSET(::firestore::NamedQuery, bundled_query_),
  PROTOBUF_FIELD_OFFSET(::firestore::NamedQuery, read_time_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::firestore::BundledDocumentMetadata, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::firestore::BundledDocumentMetadata, name_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundledDocumentMetadata, read_time_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundledDocumentMetadata, exists_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundledDocumentMetadata, queries_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, id_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, create_time_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, version_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, total_documents_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundleMetadata, total_bytes_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::firestore::BundleElement, _internal_metadata_),
  ~0u,  // no _extensions_
  PROTOBUF_FIELD_OFFSET(::firestore::BundleElement, _oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  offsetof(::firestore::BundleElementDefaultTypeInternal, metadata_),
  offsetof(::firestore::BundleElementDefaultTypeInternal, named_query_),
  offsetof(::firestore::BundleElementDefaultTypeInternal, document_metadata_),
  offsetof(::firestore::BundleElementDefaultTypeInternal, document_),
  PROTOBUF_FIELD_OFFSET(::firestore::BundleElement, element_type_),
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(::firestore::BundledQuery)},
  { 9, -1, sizeof(::firestore::NamedQuery)},
  { 17, -1, sizeof(::firestore::BundledDocumentMetadata)},
  { 26, -1, sizeof(::firestore::BundleMetadata)},
  { 36, -1, sizeof(::firestore::BundleElement)},
};

static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::_BundledQuery_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::_NamedQuery_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::_BundledDocumentMetadata_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::_BundleMetadata_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::firestore::_BundleElement_default_instance_),
};

const char descriptor_table_protodef_firestore_2fbundle_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n\026firestore/bundle.proto\022\tfirestore\032\"goo"
  "gle/firestore/v1/document.proto\032\037google/"
  "firestore/v1/query.proto\032\037google/protobu"
  "f/timestamp.proto\"\307\001\n\014BundledQuery\022\016\n\006pa"
  "rent\030\001 \001(\t\022@\n\020structured_query\030\002 \001(\0132$.g"
  "oogle.firestore.v1.StructuredQueryH\000\0225\n\n"
  "limit_type\030\003 \001(\0162!.firestore.BundledQuer"
  "y.LimitType\" \n\tLimitType\022\t\n\005FIRST\020\000\022\010\n\004L"
  "AST\020\001B\014\n\nquery_type\"y\n\nNamedQuery\022\014\n\004nam"
  "e\030\001 \001(\t\022.\n\rbundled_query\030\002 \001(\0132\027.firesto"
  "re.BundledQuery\022-\n\tread_time\030\003 \001(\0132\032.goo"
  "gle.protobuf.Timestamp\"w\n\027BundledDocumen"
  "tMetadata\022\014\n\004name\030\001 \001(\t\022-\n\tread_time\030\002 \001"
  "(\0132\032.google.protobuf.Timestamp\022\016\n\006exists"
  "\030\003 \001(\010\022\017\n\007queries\030\004 \003(\t\"\214\001\n\016BundleMetada"
  "ta\022\n\n\002id\030\001 \001(\t\022/\n\013create_time\030\002 \001(\0132\032.go"
  "ogle.protobuf.Timestamp\022\017\n\007version\030\003 \001(\r"
  "\022\027\n\017total_documents\030\004 \001(\r\022\023\n\013total_bytes"
  "\030\005 \001(\004\"\360\001\n\rBundleElement\022-\n\010metadata\030\001 \001"
  "(\0132\031.firestore.BundleMetadataH\000\022,\n\013named"
  "_query\030\002 \001(\0132\025.firestore.NamedQueryH\000\022\?\n"
  "\021document_metadata\030\003 \001(\0132\".firestore.Bun"
  "dledDocumentMetadataH\000\0221\n\010document\030\004 \001(\013"
  "2\035.google.firestore.v1.DocumentH\000B\016\n\014ele"
  "ment_typeB\215\001\n\032com.google.firestore.proto"
  "B\013BundleProtoP\001Z4google.golang.org/genpr"
  "oto/firestore/proto;firestore\242\002\005FSTPB\252\002\017"
  "Firestore.Proto\312\002\017Firestore\\Protob\006proto"
  "3"
  ;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_firestore_2fbundle_2eproto_deps[3] = {
  &::descriptor_table_google_2ffirestore_2fv1_2fdocument_2eproto,
  &::descriptor_table_google_2ffirestore_2fv1_2fquery_2eproto,
  &::descriptor_table_google_2fprotobuf_2ftimestamp_2eproto,
};
static ::PROTOBUF_NAMESPACE_ID::internal::SCCInfoBase*const descriptor_table_firestore_2fbundle_2eproto_sccs[5] = {
  &scc_info_BundleElement_firestore_2fbundle_2eproto.base,
  &scc_info_BundleMetadata_firestore_2fbundle_2eproto.base,
  &scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto.base,
  &scc_info_BundledQuery_firestore_2fbundle_2eproto.base,
  &scc_info_NamedQuery_firestore_2fbundle_2eproto.base,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_firestore_2fbundle_2eproto_once;
static bool descriptor_table_firestore_2fbundle_2eproto_initialized = false;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_firestore_2fbundle_2eproto = {
  &descriptor_table_firestore_2fbundle_2eproto_initialized, descriptor_table_protodef_firestore_2fbundle_2eproto, "firestore/bundle.proto", 1121,
  &descriptor_table_firestore_2fbundle_2eproto_once, descriptor_table_firestore_2fbundle_2eproto_sccs, descriptor_table_firestore_2fbundle_2eproto_deps, 5, 3,
  schemas, file_default_instances, TableStruct_firestore_2fbundle_2eproto::offsets,
  file_level_metadata_firestore_2fbundle_2eproto, 5, file_level_enum_descriptors_firestore_2fbundle_2eproto, file_level_service_descriptors_firestore_2fbundle_2eproto,
};

// Force running AddDescriptors() at dynamic initialization time.
static bool dynamic_init_dummy_firestore_2fbundle_2eproto = (  ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptors(&descriptor_table_firestore_2fbundle_2eproto), true);
namespace firestore {
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* BundledQuery_LimitType_descriptor() {
  ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_firestore_2fbundle_2eproto);
  return file_level_enum_descriptors_firestore_2fbundle_2eproto[0];
}
bool BundledQuery_LimitType_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
      return true;
    default:
      return false;
  }
}

#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
constexpr BundledQuery_LimitType BundledQuery::FIRST;
constexpr BundledQuery_LimitType BundledQuery::LAST;
constexpr BundledQuery_LimitType BundledQuery::LimitType_MIN;
constexpr BundledQuery_LimitType BundledQuery::LimitType_MAX;
constexpr int BundledQuery::LimitType_ARRAYSIZE;
#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)

// ===================================================================

void BundledQuery::InitAsDefaultInstance() {
  ::firestore::_BundledQuery_default_instance_.structured_query_ = const_cast< ::google::firestore::v1::StructuredQuery*>(
      ::google::firestore::v1::StructuredQuery::internal_default_instance());
}
class BundledQuery::_Internal {
 public:
  static const ::google::firestore::v1::StructuredQuery& structured_query(const BundledQuery* msg);
};

const ::google::firestore::v1::StructuredQuery&
BundledQuery::_Internal::structured_query(const BundledQuery* msg) {
  return *msg->query_type_.structured_query_;
}
void BundledQuery::set_allocated_structured_query(::google::firestore::v1::StructuredQuery* structured_query) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
  clear_query_type();
  if (structured_query) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
    if (message_arena != submessage_arena) {
      structured_query = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, structured_query, submessage_arena);
    }
    set_has_structured_query();
    query_type_.structured_query_ = structured_query;
  }
  // @@protoc_insertion_point(field_set_allocated:firestore.BundledQuery.structured_query)
}
void BundledQuery::clear_structured_query() {
  if (_internal_has_structured_query()) {
    delete query_type_.structured_query_;
    clear_has_query_type();
  }
}
BundledQuery::BundledQuery()
  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  SharedCtor();
  // @@protoc_insertion_point(constructor:firestore.BundledQuery)
}
BundledQuery::BundledQuery(const BundledQuery& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _internal_metadata_(nullptr) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  parent_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (!from._internal_parent().empty()) {
    parent_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parent_);
  }
  limit_type_ = from.limit_type_;
  clear_has_query_type();
  switch (from.query_type_case()) {
    case kStructuredQuery: {
      _internal_mutable_structured_query()->::google::firestore::v1::StructuredQuery::MergeFrom(from._internal_structured_query());
      break;
    }
    case QUERY_TYPE_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:firestore.BundledQuery)
}

void BundledQuery::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_BundledQuery_firestore_2fbundle_2eproto.base);
  parent_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  limit_type_ = 0;
  clear_has_query_type();
}

BundledQuery::~BundledQuery() {
  // @@protoc_insertion_point(destructor:firestore.BundledQuery)
  SharedDtor();
}

void BundledQuery::SharedDtor() {
  parent_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (has_query_type()) {
    clear_query_type();
  }
}

void BundledQuery::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const BundledQuery& BundledQuery::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BundledQuery_firestore_2fbundle_2eproto.base);
  return *internal_default_instance();
}


void BundledQuery::clear_query_type() {
// @@protoc_insertion_point(one_of_clear_start:firestore.BundledQuery)
  switch (query_type_case()) {
    case kStructuredQuery: {
      delete query_type_.structured_query_;
      break;
    }
    case QUERY_TYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = QUERY_TYPE_NOT_SET;
}


void BundledQuery::Clear() {
// @@protoc_insertion_point(message_clear_start:firestore.BundledQuery)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  parent_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  limit_type_ = 0;
  clear_query_type();
  _internal_metadata_.Clear();
}

const char* BundledQuery::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // string parent = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_parent();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "firestore.BundledQuery.parent"));
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .google.firestore.v1.StructuredQuery structured_query = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_structured_query(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .firestore.BundledQuery.LimitType limit_type = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
          CHK_(ptr);
          _internal_set_limit_type(static_cast<::firestore::BundledQuery_LimitType>(val));
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* BundledQuery::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:firestore.BundledQuery)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string parent = 1;
  if (this->parent().size() > 0) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_parent().data(), static_cast<int>(this->_internal_parent().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "firestore.BundledQuery.parent");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_parent(), target);
  }

  // .google.firestore.v1.StructuredQuery structured_query = 2;
  if (_internal_has_structured_query()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::structured_query(this), target, stream);
  }

  // .firestore.BundledQuery.LimitType limit_type = 3;
  if (this->limit_type() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray(
      3, this->_internal_limit_type(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:firestore.BundledQuery)
  return target;
}

size_t BundledQuery::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:firestore.BundledQuery)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // string parent = 1;
  if (this->parent().size() > 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_parent());
  }

  // .firestore.BundledQuery.LimitType limit_type = 3;
  if (this->limit_type() != 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_limit_type());
  }

  switch (query_type_case()) {
    // .google.firestore.v1.StructuredQuery structured_query = 2;
    case kStructuredQuery: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *query_type_.structured_query_);
      break;
    }
    case QUERY_TYPE_NOT_SET: {
      break;
    }
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BundledQuery::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:firestore.BundledQuery)
  GOOGLE_DCHECK_NE(&from, this);
  const BundledQuery* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<BundledQuery>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.BundledQuery)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.BundledQuery)
    MergeFrom(*source);
  }
}

void BundledQuery::MergeFrom(const BundledQuery& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:firestore.BundledQuery)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.parent().size() > 0) {

    parent_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.parent_);
  }
  if (from.limit_type() != 0) {
    _internal_set_limit_type(from._internal_limit_type());
  }
  switch (from.query_type_case()) {
    case kStructuredQuery: {
      _internal_mutable_structured_query()->::google::firestore::v1::StructuredQuery::MergeFrom(from._internal_structured_query());
      break;
    }
    case QUERY_TYPE_NOT_SET: {
      break;
    }
  }
}

void BundledQuery::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:firestore.BundledQuery)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void BundledQuery::CopyFrom(const BundledQuery& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:firestore.BundledQuery)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool BundledQuery::IsInitialized() const {
  return true;
}

void BundledQuery::InternalSwap(BundledQuery* other) {
  using std::swap;
  _internal_metadata_.Swap(&other->_internal_metadata_);
  parent_.Swap(&other->parent_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(limit_type_, other->limit_type_);
  swap(query_type_, other->query_type_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
}

::PROTOBUF_NAMESPACE_ID::Metadata BundledQuery::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

void NamedQuery::InitAsDefaultInstance() {
  ::firestore::_NamedQuery_default_instance_._instance.get_mutable()->bundled_query_ = const_cast< ::firestore::BundledQuery*>(
      ::firestore::BundledQuery::internal_default_instance());
  ::firestore::_NamedQuery_default_instance_._instance.get_mutable()->read_time_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>(
      PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance());
}
class NamedQuery::_Internal {
 public:
  static const ::firestore::BundledQuery& bundled_query(const NamedQuery* msg);
  static const PROTOBUF_NAMESPACE_ID::Timestamp& read_time(const NamedQuery* msg);
};

const ::firestore::BundledQuery&
NamedQuery::_Internal::bundled_query(const NamedQuery* msg) {
  return *msg->bundled_query_;
}
const PROTOBUF_NAMESPACE_ID::Timestamp&
NamedQuery::_Internal::read_time(const NamedQuery* msg) {
  return *msg->read_time_;
}
void NamedQuery::clear_read_time() {
  if (GetArenaNoVirtual() == nullptr && read_time_ != nullptr) {
    delete read_time_;
  }
  read_time_ = nullptr;
}
NamedQuery::NamedQuery()
  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  SharedCtor();
  // @@protoc_insertion_point(constructor:firestore.NamedQuery)
}
NamedQuery::NamedQuery(const NamedQuery& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _internal_metadata_(nullptr) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (!from._internal_name().empty()) {
    name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  if (from._internal_has_bundled_query()) {
    bundled_query_ = new ::firestore::BundledQuery(*from.bundled_query_);
  } else {
    bundled_query_ = nullptr;
  }
  if (from._internal_has_read_time()) {
    read_time_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.read_time_);
  } else {
    read_time_ = nullptr;
  }
  // @@protoc_insertion_point(copy_constructor:firestore.NamedQuery)
}

void NamedQuery::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_NamedQuery_firestore_2fbundle_2eproto.base);
  name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  ::memset(&bundled_query_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&read_time_) -
      reinterpret_cast<char*>(&bundled_query_)) + sizeof(read_time_));
}

NamedQuery::~NamedQuery() {
  // @@protoc_insertion_point(destructor:firestore.NamedQuery)
  SharedDtor();
}

void NamedQuery::SharedDtor() {
  name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete bundled_query_;
  if (this != internal_default_instance()) delete read_time_;
}

void NamedQuery::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const NamedQuery& NamedQuery::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_NamedQuery_firestore_2fbundle_2eproto.base);
  return *internal_default_instance();
}


void NamedQuery::Clear() {
// @@protoc_insertion_point(message_clear_start:firestore.NamedQuery)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (GetArenaNoVirtual() == nullptr && bundled_query_ != nullptr) {
    delete bundled_query_;
  }
  bundled_query_ = nullptr;
  if (GetArenaNoVirtual() == nullptr && read_time_ != nullptr) {
    delete read_time_;
  }
  read_time_ = nullptr;
  _internal_metadata_.Clear();
}

const char* NamedQuery::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // string name = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_name();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "firestore.NamedQuery.name"));
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .firestore.BundledQuery bundled_query = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_bundled_query(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .google.protobuf.Timestamp read_time = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_read_time(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* NamedQuery::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:firestore.NamedQuery)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string name = 1;
  if (this->name().size() > 0) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "firestore.NamedQuery.name");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_name(), target);
  }

  // .firestore.BundledQuery bundled_query = 2;
  if (this->has_bundled_query()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::bundled_query(this), target, stream);
  }

  // .google.protobuf.Timestamp read_time = 3;
  if (this->has_read_time()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        3, _Internal::read_time(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:firestore.NamedQuery)
  return target;
}

size_t NamedQuery::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:firestore.NamedQuery)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // string name = 1;
  if (this->name().size() > 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_name());
  }

  // .firestore.BundledQuery bundled_query = 2;
  if (this->has_bundled_query()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *bundled_query_);
  }

  // .google.protobuf.Timestamp read_time = 3;
  if (this->has_read_time()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *read_time_);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void NamedQuery::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:firestore.NamedQuery)
  GOOGLE_DCHECK_NE(&from, this);
  const NamedQuery* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<NamedQuery>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.NamedQuery)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.NamedQuery)
    MergeFrom(*source);
  }
}

void NamedQuery::MergeFrom(const NamedQuery& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:firestore.NamedQuery)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.name().size() > 0) {

    name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  if (from.has_bundled_query()) {
    _internal_mutable_bundled_query()->::firestore::BundledQuery::MergeFrom(from._internal_bundled_query());
  }
  if (from.has_read_time()) {
    _internal_mutable_read_time()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from._internal_read_time());
  }
}

void NamedQuery::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:firestore.NamedQuery)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void NamedQuery::CopyFrom(const NamedQuery& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:firestore.NamedQuery)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool NamedQuery::IsInitialized() const {
  return true;
}

void NamedQuery::InternalSwap(NamedQuery* other) {
  using std::swap;
  _internal_metadata_.Swap(&other->_internal_metadata_);
  name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(bundled_query_, other->bundled_query_);
  swap(read_time_, other->read_time_);
}

::PROTOBUF_NAMESPACE_ID::Metadata NamedQuery::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

void BundledDocumentMetadata::InitAsDefaultInstance() {
  ::firestore::_BundledDocumentMetadata_default_instance_._instance.get_mutable()->read_time_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>(
      PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance());
}
class BundledDocumentMetadata::_Internal {
 public:
  static const PROTOBUF_NAMESPACE_ID::Timestamp& read_time(const BundledDocumentMetadata* msg);
};

const PROTOBUF_NAMESPACE_ID::Timestamp&
BundledDocumentMetadata::_Internal::read_time(const BundledDocumentMetadata* msg) {
  return *msg->read_time_;
}
void BundledDocumentMetadata::clear_read_time() {
  if (GetArenaNoVirtual() == nullptr && read_time_ != nullptr) {
    delete read_time_;
  }
  read_time_ = nullptr;
}
BundledDocumentMetadata::BundledDocumentMetadata()
  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  SharedCtor();
  // @@protoc_insertion_point(constructor:firestore.BundledDocumentMetadata)
}
BundledDocumentMetadata::BundledDocumentMetadata(const BundledDocumentMetadata& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _internal_metadata_(nullptr),
      queries_(from.queries_) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (!from._internal_name().empty()) {
    name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  if (from._internal_has_read_time()) {
    read_time_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.read_time_);
  } else {
    read_time_ = nullptr;
  }
  exists_ = from.exists_;
  // @@protoc_insertion_point(copy_constructor:firestore.BundledDocumentMetadata)
}

void BundledDocumentMetadata::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto.base);
  name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  ::memset(&read_time_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&exists_) -
      reinterpret_cast<char*>(&read_time_)) + sizeof(exists_));
}

BundledDocumentMetadata::~BundledDocumentMetadata() {
  // @@protoc_insertion_point(destructor:firestore.BundledDocumentMetadata)
  SharedDtor();
}

void BundledDocumentMetadata::SharedDtor() {
  name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete read_time_;
}

void BundledDocumentMetadata::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const BundledDocumentMetadata& BundledDocumentMetadata::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BundledDocumentMetadata_firestore_2fbundle_2eproto.base);
  return *internal_default_instance();
}


void BundledDocumentMetadata::Clear() {
// @@protoc_insertion_point(message_clear_start:firestore.BundledDocumentMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  queries_.Clear();
  name_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (GetArenaNoVirtual() == nullptr && read_time_ != nullptr) {
    delete read_time_;
  }
  read_time_ = nullptr;
  exists_ = false;
  _internal_metadata_.Clear();
}

const char* BundledDocumentMetadata::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // string name = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_name();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "firestore.BundledDocumentMetadata.name"));
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .google.protobuf.Timestamp read_time = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_read_time(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // bool exists = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          exists_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // repeated string queries = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
          ptr -= 1;
          do {
            ptr += 1;
            auto str = _internal_add_queries();
            ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
            CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "firestore.BundledDocumentMetadata.queries"));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr));
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* BundledDocumentMetadata::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:firestore.BundledDocumentMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string name = 1;
  if (this->name().size() > 0) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "firestore.BundledDocumentMetadata.name");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_name(), target);
  }

  // .google.protobuf.Timestamp read_time = 2;
  if (this->has_read_time()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::read_time(this), target, stream);
  }

  // bool exists = 3;
  if (this->exists() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_exists(), target);
  }

  // repeated string queries = 4;
  for (int i = 0, n = this->_internal_queries_size(); i < n; i++) {
    const auto& s = this->_internal_queries(i);
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      s.data(), static_cast<int>(s.length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "firestore.BundledDocumentMetadata.queries");
    target = stream->WriteString(4, s, target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:firestore.BundledDocumentMetadata)
  return target;
}

size_t BundledDocumentMetadata::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:firestore.BundledDocumentMetadata)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated string queries = 4;
  total_size += 1 *
      ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(queries_.size());
  for (int i = 0, n = queries_.size(); i < n; i++) {
    total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
      queries_.Get(i));
  }

  // string name = 1;
  if (this->name().size() > 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_name());
  }

  // .google.protobuf.Timestamp read_time = 2;
  if (this->has_read_time()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *read_time_);
  }

  // bool exists = 3;
  if (this->exists() != 0) {
    total_size += 1 + 1;
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BundledDocumentMetadata::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:firestore.BundledDocumentMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  const BundledDocumentMetadata* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<BundledDocumentMetadata>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.BundledDocumentMetadata)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.BundledDocumentMetadata)
    MergeFrom(*source);
  }
}

void BundledDocumentMetadata::MergeFrom(const BundledDocumentMetadata& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:firestore.BundledDocumentMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  queries_.MergeFrom(from.queries_);
  if (from.name().size() > 0) {

    name_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.name_);
  }
  if (from.has_read_time()) {
    _internal_mutable_read_time()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from._internal_read_time());
  }
  if (from.exists() != 0) {
    _internal_set_exists(from._internal_exists());
  }
}

void BundledDocumentMetadata::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:firestore.BundledDocumentMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void BundledDocumentMetadata::CopyFrom(const BundledDocumentMetadata& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:firestore.BundledDocumentMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool BundledDocumentMetadata::IsInitialized() const {
  return true;
}

void BundledDocumentMetadata::InternalSwap(BundledDocumentMetadata* other) {
  using std::swap;
  _internal_metadata_.Swap(&other->_internal_metadata_);
  queries_.InternalSwap(&other->queries_);
  name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(read_time_, other->read_time_);
  swap(exists_, other->exists_);
}

::PROTOBUF_NAMESPACE_ID::Metadata BundledDocumentMetadata::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

void BundleMetadata::InitAsDefaultInstance() {
  ::firestore::_BundleMetadata_default_instance_._instance.get_mutable()->create_time_ = const_cast< PROTOBUF_NAMESPACE_ID::Timestamp*>(
      PROTOBUF_NAMESPACE_ID::Timestamp::internal_default_instance());
}
class BundleMetadata::_Internal {
 public:
  static const PROTOBUF_NAMESPACE_ID::Timestamp& create_time(const BundleMetadata* msg);
};

const PROTOBUF_NAMESPACE_ID::Timestamp&
BundleMetadata::_Internal::create_time(const BundleMetadata* msg) {
  return *msg->create_time_;
}
void BundleMetadata::clear_create_time() {
  if (GetArenaNoVirtual() == nullptr && create_time_ != nullptr) {
    delete create_time_;
  }
  create_time_ = nullptr;
}
BundleMetadata::BundleMetadata()
  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  SharedCtor();
  // @@protoc_insertion_point(constructor:firestore.BundleMetadata)
}
BundleMetadata::BundleMetadata(const BundleMetadata& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _internal_metadata_(nullptr) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (!from._internal_id().empty()) {
    id_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.id_);
  }
  if (from._internal_has_create_time()) {
    create_time_ = new PROTOBUF_NAMESPACE_ID::Timestamp(*from.create_time_);
  } else {
    create_time_ = nullptr;
  }
  ::memcpy(&version_, &from.version_,
    static_cast<size_t>(reinterpret_cast<char*>(&total_bytes_) -
    reinterpret_cast<char*>(&version_)) + sizeof(total_bytes_));
  // @@protoc_insertion_point(copy_constructor:firestore.BundleMetadata)
}

void BundleMetadata::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_BundleMetadata_firestore_2fbundle_2eproto.base);
  id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  ::memset(&create_time_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&total_bytes_) -
      reinterpret_cast<char*>(&create_time_)) + sizeof(total_bytes_));
}

BundleMetadata::~BundleMetadata() {
  // @@protoc_insertion_point(destructor:firestore.BundleMetadata)
  SharedDtor();
}

void BundleMetadata::SharedDtor() {
  id_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (this != internal_default_instance()) delete create_time_;
}

void BundleMetadata::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const BundleMetadata& BundleMetadata::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BundleMetadata_firestore_2fbundle_2eproto.base);
  return *internal_default_instance();
}


void BundleMetadata::Clear() {
// @@protoc_insertion_point(message_clear_start:firestore.BundleMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  id_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (GetArenaNoVirtual() == nullptr && create_time_ != nullptr) {
    delete create_time_;
  }
  create_time_ = nullptr;
  ::memset(&version_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&total_bytes_) -
      reinterpret_cast<char*>(&version_)) + sizeof(total_bytes_));
  _internal_metadata_.Clear();
}

const char* BundleMetadata::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // string id = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_id();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "firestore.BundleMetadata.id"));
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .google.protobuf.Timestamp create_time = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_create_time(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // uint32 version = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // uint32 total_documents = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
          total_documents_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // uint64 total_bytes = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
          total_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* BundleMetadata::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:firestore.BundleMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // string id = 1;
  if (this->id().size() > 0) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
      this->_internal_id().data(), static_cast<int>(this->_internal_id().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
      "firestore.BundleMetadata.id");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_id(), target);
  }

  // .google.protobuf.Timestamp create_time = 2;
  if (this->has_create_time()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::create_time(this), target, stream);
  }

  // uint32 version = 3;
  if (this->version() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_version(), target);
  }

  // uint32 total_documents = 4;
  if (this->total_documents() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(4, this->_internal_total_documents(), target);
  }

  // uint64 total_bytes = 5;
  if (this->total_bytes() != 0) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(5, this->_internal_total_bytes(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:firestore.BundleMetadata)
  return target;
}

size_t BundleMetadata::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:firestore.BundleMetadata)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // string id = 1;
  if (this->id().size() > 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_id());
  }

  // .google.protobuf.Timestamp create_time = 2;
  if (this->has_create_time()) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
        *create_time_);
  }

  // uint32 version = 3;
  if (this->version() != 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size(
        this->_internal_version());
  }

  // uint32 total_documents = 4;
  if (this->total_documents() != 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size(
        this->_internal_total_documents());
  }

  // uint64 total_bytes = 5;
  if (this->total_bytes() != 0) {
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_total_bytes());
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BundleMetadata::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:firestore.BundleMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  const BundleMetadata* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<BundleMetadata>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.BundleMetadata)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.BundleMetadata)
    MergeFrom(*source);
  }
}

void BundleMetadata::MergeFrom(const BundleMetadata& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:firestore.BundleMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.id().size() > 0) {

    id_.AssignWithDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from.id_);
  }
  if (from.has_create_time()) {
    _internal_mutable_create_time()->PROTOBUF_NAMESPACE_ID::Timestamp::MergeFrom(from._internal_create_time());
  }
  if (from.version() != 0) {
    _internal_set_version(from._internal_version());
  }
  if (from.total_documents() != 0) {
    _internal_set_total_documents(from._internal_total_documents());
  }
  if (from.total_bytes() != 0) {
    _internal_set_total_bytes(from._internal_total_bytes());
  }
}

void BundleMetadata::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:firestore.BundleMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void BundleMetadata::CopyFrom(const BundleMetadata& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:firestore.BundleMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool BundleMetadata::IsInitialized() const {
  return true;
}

void BundleMetadata::InternalSwap(BundleMetadata* other) {
  using std::swap;
  _internal_metadata_.Swap(&other->_internal_metadata_);
  id_.Swap(&other->id_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
    GetArenaNoVirtual());
  swap(create_time_, other->create_time_);
  swap(version_, other->version_);
  swap(total_documents_, other->total_documents_);
  swap(total_bytes_, other->total_bytes_);
}

::PROTOBUF_NAMESPACE_ID::Metadata BundleMetadata::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

void BundleElement::InitAsDefaultInstance() {
  ::firestore::_BundleElement_default_instance_.metadata_ = const_cast< ::firestore::BundleMetadata*>(
      ::firestore::BundleMetadata::internal_default_instance());
  ::firestore::_BundleElement_default_instance_.named_query_ = const_cast< ::firestore::NamedQuery*>(
      ::firestore::NamedQuery::internal_default_instance());
  ::firestore::_BundleElement_default_instance_.document_metadata_ = const_cast< ::firestore::BundledDocumentMetadata*>(
      ::firestore::BundledDocumentMetadata::internal_default_instance());
  ::firestore::_BundleElement_default_instance_.document_ = const_cast< ::google::firestore::v1::Document*>(
      ::google::firestore::v1::Document::internal_default_instance());
}
class BundleElement::_Internal {
 public:
  static const ::firestore::BundleMetadata& metadata(const BundleElement* msg);
  static const ::firestore::NamedQuery& named_query(const BundleElement* msg);
  static const ::firestore::BundledDocumentMetadata& document_metadata(const BundleElement* msg);
  static const ::google::firestore::v1::Document& document(const BundleElement* msg);
};

const ::firestore::BundleMetadata&
BundleElement::_Internal::metadata(const BundleElement* msg) {
  return *msg->element_type_.metadata_;
}
const ::firestore::NamedQuery&
BundleElement::_Internal::named_query(const BundleElement* msg) {
  return *msg->element_type_.named_query_;
}
const ::firestore::BundledDocumentMetadata&
BundleElement::_Internal::document_metadata(const BundleElement* msg) {
  return *msg->element_type_.document_metadata_;
}
const ::google::firestore::v1::Document&
BundleElement::_Internal::document(const BundleElement* msg) {
  return *msg->element_type_.document_;
}
void BundleElement::set_allocated_metadata(::firestore::BundleMetadata* metadata) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
  clear_element_type();
  if (metadata) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
    if (message_arena != submessage_arena) {
      metadata = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, metadata, submessage_arena);
    }
    set_has_metadata();
    element_type_.metadata_ = metadata;
  }
  // @@protoc_insertion_point(field_set_allocated:firestore.BundleElement.metadata)
}
void BundleElement::set_allocated_named_query(::firestore::NamedQuery* named_query) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
  clear_element_type();
  if (named_query) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
    if (message_arena != submessage_arena) {
      named_query = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, named_query, submessage_arena);
    }
    set_has_named_query();
    element_type_.named_query_ = named_query;
  }
  // @@protoc_insertion_point(field_set_allocated:firestore.BundleElement.named_query)
}
void BundleElement::set_allocated_document_metadata(::firestore::BundledDocumentMetadata* document_metadata) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
  clear_element_type();
  if (document_metadata) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
    if (message_arena != submessage_arena) {
      document_metadata = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, document_metadata, submessage_arena);
    }
    set_has_document_metadata();
    element_type_.document_metadata_ = document_metadata;
  }
  // @@protoc_insertion_point(field_set_allocated:firestore.BundleElement.document_metadata)
}
void BundleElement::set_allocated_document(::google::firestore::v1::Document* document) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
  clear_element_type();
  if (document) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
    if (message_arena != submessage_arena) {
      document = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, document, submessage_arena);
    }
    set_has_document();
    element_type_.document_ = document;
  }
  // @@protoc_insertion_point(field_set_allocated:firestore.BundleElement.document)
}
void BundleElement::clear_document() {
  if (_internal_has_document()) {
    delete element_type_.document_;
    clear_has_element_type();
  }
}
BundleElement::BundleElement()
  : ::PROTOBUF_NAMESPACE_ID::Message(), _internal_metadata_(nullptr) {
  SharedCtor();
  // @@protoc_insertion_point(constructor:firestore.BundleElement)
}
BundleElement::BundleElement(const BundleElement& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _internal_metadata_(nullptr) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  clear_has_element_type();
  switch (from.element_type_case()) {
    case kMetadata: {
      _internal_mutable_metadata()->::firestore::BundleMetadata::MergeFrom(from._internal_metadata());
      break;
    }
    case kNamedQuery: {
      _internal_mutable_named_query()->::firestore::NamedQuery::MergeFrom(from._internal_named_query());
      break;
    }
    case kDocumentMetadata: {
      _internal_mutable_document_metadata()->::firestore::BundledDocumentMetadata::MergeFrom(from._internal_document_metadata());
      break;
    }
    case kDocument: {
      _internal_mutable_document()->::google::firestore::v1::Document::MergeFrom(from._internal_document());
      break;
    }
    case ELEMENT_TYPE_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:firestore.BundleElement)
}

void BundleElement::SharedCtor() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_BundleElement_firestore_2fbundle_2eproto.base);
  clear_has_element_type();
}

BundleElement::~BundleElement() {
  // @@protoc_insertion_point(destructor:firestore.BundleElement)
  SharedDtor();
}

void BundleElement::SharedDtor() {
  if (has_element_type()) {
    clear_element_type();
  }
}

void BundleElement::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}
const BundleElement& BundleElement::default_instance() {
  ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_BundleElement_firestore_2fbundle_2eproto.base);
  return *internal_default_instance();
}


void BundleElement::clear_element_type() {
// @@protoc_insertion_point(one_of_clear_start:firestore.BundleElement)
  switch (element_type_case()) {
    case kMetadata: {
      delete element_type_.metadata_;
      break;
    }
    case kNamedQuery: {
      delete element_type_.named_query_;
      break;
    }
    case kDocumentMetadata: {
      delete element_type_.document_metadata_;
      break;
    }
    case kDocument: {
      delete element_type_.document_;
      break;
    }
    case ELEMENT_TYPE_NOT_SET: {
      break;
    }
  }
  _oneof_case_[0] = ELEMENT_TYPE_NOT_SET;
}


void BundleElement::Clear() {
// @@protoc_insertion_point(message_clear_start:firestore.BundleElement)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  clear_element_type();
  _internal_metadata_.Clear();
}

const char* BundleElement::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // .firestore.BundleMetadata metadata = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_metadata(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .firestore.NamedQuery named_query = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_named_query(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .firestore.BundledDocumentMetadata document_metadata = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_document_metadata(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // .google.firestore.v1.Document document = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_document(), ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag, &_internal_metadata_, ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* BundleElement::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:firestore.BundleElement)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // .firestore.BundleMetadata metadata = 1;
  if (_internal_has_metadata()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        1, _Internal::metadata(this), target, stream);
  }

  // .firestore.NamedQuery named_query = 2;
  if (_internal_has_named_query()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        2, _Internal::named_query(this), target, stream);
  }

  // .firestore.BundledDocumentMetadata document_metadata = 3;
  if (_internal_has_document_metadata()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        3, _Internal::document_metadata(this), target, stream);
  }

  // .google.firestore.v1.Document document = 4;
  if (_internal_has_document()) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        4, _Internal::document(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields(), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:firestore.BundleElement)
  return target;
}

size_t BundleElement::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:firestore.BundleElement)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  switch (element_type_case()) {
    // .firestore.BundleMetadata metadata = 1;
    case kMetadata: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *element_type_.metadata_);
      break;
    }
    // .firestore.NamedQuery named_query = 2;
    case kNamedQuery: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *element_type_.named_query_);
      break;
    }
    // .firestore.BundledDocumentMetadata document_metadata = 3;
    case kDocumentMetadata: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *element_type_.document_metadata_);
      break;
    }
    // .google.firestore.v1.Document document = 4;
    case kDocument: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *element_type_.document_);
      break;
    }
    case ELEMENT_TYPE_NOT_SET: {
      break;
    }
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BundleElement::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:firestore.BundleElement)
  GOOGLE_DCHECK_NE(&from, this);
  const BundleElement* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<BundleElement>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:firestore.BundleElement)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:firestore.BundleElement)
    MergeFrom(*source);
  }
}

void BundleElement::MergeFrom(const BundleElement& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:firestore.BundleElement)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  switch (from.element_type_case()) {
    case kMetadata: {
      _internal_mutable_metadata()->::firestore::BundleMetadata::MergeFrom(from._internal_metadata());
      break;
    }
    case kNamedQuery: {
      _internal_mutable_named_query()->::firestore::NamedQuery::MergeFrom(from._internal_named_query());
      break;
    }
    case kDocumentMetadata: {
      _internal_mutable_document_metadata()->::firestore::BundledDocumentMetadata::MergeFrom(from._internal_document_metadata());
      break;
    }
    case kDocument: {
      _internal_mutable_document()->::google::firestore::v1::Document::MergeFrom(from._internal_document());
      break;
    }
    case ELEMENT_TYPE_NOT_SET: {
      break;
    }
  }
}

void BundleElement::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:firestore.BundleElement)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void BundleElement::CopyFrom(const BundleElement& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:firestore.BundleElement)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool BundleElement::IsInitialized() const {
  return true;
}

void BundleElement::InternalSwap(BundleElement* other) {
  using std::swap;
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(element_type_, other->element_type_);
  swap(_oneof_case_[0], other->_oneof_case_[0]);
}

::PROTOBUF_NAMESPACE_ID::Metadata BundleElement::GetMetadata() const {
  return GetMetadataStatic();
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace firestore
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::firestore::BundledQuery* Arena::CreateMaybeMessage< ::firestore::BundledQuery >(Arena* arena) {
  return Arena::CreateInternal< ::firestore::BundledQuery >(arena);
}
template<> PROTOBUF_NOINLINE ::firestore::NamedQuery* Arena::CreateMaybeMessage< ::firestore::NamedQuery >(Arena* arena) {
  return Arena::CreateInternal< ::firestore::NamedQuery >(arena);
}
template<> PROTOBUF_NOINLINE ::firestore::BundledDocumentMetadata* Arena::CreateMaybeMessage< ::firestore::BundledDocumentMetadata >(Arena* arena) {
  return Arena::CreateInternal< ::firestore::BundledDocumentMetadata >(arena);
}
template<> PROTOBUF_NOINLINE ::firestore::BundleMetadata* Arena::CreateMaybeMessage< ::firestore::BundleMetadata >(Arena* arena) {
  return Arena::CreateInternal< ::firestore::BundleMetadata >(arena);
}
template<> PROTOBUF_NOINLINE ::firestore::BundleElement* Arena::CreateMaybeMessage< ::firestore::BundleElement >(Arena* arena) {
  return Arena::CreateInternal< ::firestore::BundleElement >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
