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

package com.google.firestore.v1beta1;

/**
 * <pre>
 * The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
 * </pre>
 *
 * Protobuf type {@code google.firestore.v1beta1.BatchGetDocumentsResponse}
 */
public  final class BatchGetDocumentsResponse extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:google.firestore.v1beta1.BatchGetDocumentsResponse)
    BatchGetDocumentsResponseOrBuilder {
private static final long serialVersionUID = 0L;
  // Use BatchGetDocumentsResponse.newBuilder() to construct.
  private BatchGetDocumentsResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private BatchGetDocumentsResponse() {
    transaction_ = com.google.protobuf.ByteString.EMPTY;
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private BatchGetDocumentsResponse(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!parseUnknownFieldProto3(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            com.google.firestore.v1beta1.Document.Builder subBuilder = null;
            if (resultCase_ == 1) {
              subBuilder = ((com.google.firestore.v1beta1.Document) result_).toBuilder();
            }
            result_ =
                input.readMessage(com.google.firestore.v1beta1.Document.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom((com.google.firestore.v1beta1.Document) result_);
              result_ = subBuilder.buildPartial();
            }
            resultCase_ = 1;
            break;
          }
          case 18: {
            java.lang.String s = input.readStringRequireUtf8();
            resultCase_ = 2;
            result_ = s;
            break;
          }
          case 26: {

            transaction_ = input.readBytes();
            break;
          }
          case 34: {
            com.google.protobuf.Timestamp.Builder subBuilder = null;
            if (readTime_ != null) {
              subBuilder = readTime_.toBuilder();
            }
            readTime_ = input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(readTime_);
              readTime_ = subBuilder.buildPartial();
            }

            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.google.firestore.v1beta1.FirestoreProto.internal_static_google_firestore_v1beta1_BatchGetDocumentsResponse_descriptor;
  }

  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.firestore.v1beta1.FirestoreProto.internal_static_google_firestore_v1beta1_BatchGetDocumentsResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.firestore.v1beta1.BatchGetDocumentsResponse.class, com.google.firestore.v1beta1.BatchGetDocumentsResponse.Builder.class);
  }

  private int resultCase_ = 0;
  private java.lang.Object result_;
  public enum ResultCase
      implements com.google.protobuf.Internal.EnumLite {
    FOUND(1),
    MISSING(2),
    RESULT_NOT_SET(0);
    private final int value;
    private ResultCase(int value) {
      this.value = value;
    }
    /**
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ResultCase valueOf(int value) {
      return forNumber(value);
    }

    public static ResultCase forNumber(int value) {
      switch (value) {
        case 1: return FOUND;
        case 2: return MISSING;
        case 0: return RESULT_NOT_SET;
        default: return null;
      }
    }
    public int getNumber() {
      return this.value;
    }
  };

  public ResultCase
  getResultCase() {
    return ResultCase.forNumber(
        resultCase_);
  }

  public static final int FOUND_FIELD_NUMBER = 1;
  /**
   * <pre>
   * A document that was requested.
   * </pre>
   *
   * <code>.google.firestore.v1beta1.Document found = 1;</code>
   */
  public boolean hasFound() {
    return resultCase_ == 1;
  }
  /**
   * <pre>
   * A document that was requested.
   * </pre>
   *
   * <code>.google.firestore.v1beta1.Document found = 1;</code>
   */
  public com.google.firestore.v1beta1.Document getFound() {
    if (resultCase_ == 1) {
       return (com.google.firestore.v1beta1.Document) result_;
    }
    return com.google.firestore.v1beta1.Document.getDefaultInstance();
  }
  /**
   * <pre>
   * A document that was requested.
   * </pre>
   *
   * <code>.google.firestore.v1beta1.Document found = 1;</code>
   */
  public com.google.firestore.v1beta1.DocumentOrBuilder getFoundOrBuilder() {
    if (resultCase_ == 1) {
       return (com.google.firestore.v1beta1.Document) result_;
    }
    return com.google.firestore.v1beta1.Document.getDefaultInstance();
  }

  public static final int MISSING_FIELD_NUMBER = 2;
  /**
   * <pre>
   * A document name that was requested but does not exist. In the format:
   * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
   * </pre>
   *
   * <code>string missing = 2;</code>
   */
  public java.lang.String getMissing() {
    java.lang.Object ref = "";
    if (resultCase_ == 2) {
      ref = result_;
    }
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (resultCase_ == 2) {
        result_ = s;
      }
      return s;
    }
  }
  /**
   * <pre>
   * A document name that was requested but does not exist. In the format:
   * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
   * </pre>
   *
   * <code>string missing = 2;</code>
   */
  public com.google.protobuf.ByteString
      getMissingBytes() {
    java.lang.Object ref = "";
    if (resultCase_ == 2) {
      ref = result_;
    }
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      if (resultCase_ == 2) {
        result_ = b;
      }
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TRANSACTION_FIELD_NUMBER = 3;
  private com.google.protobuf.ByteString transaction_;
  /**
   * <pre>
   * The transaction that was started as part of this request.
   * Will only be set in the first response, and only if
   * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
   * </pre>
   *
   * <code>bytes transaction = 3;</code>
   */
  public com.google.protobuf.ByteString getTransaction() {
    return transaction_;
  }

  public static final int READ_TIME_FIELD_NUMBER = 4;
  private com.google.protobuf.Timestamp readTime_;
  /**
   * <pre>
   * The time at which the document was read.
   * This may be monotically increasing, in this case the previous documents in
   * the result stream are guaranteed not to have changed between their
   * read_time and this one.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp read_time = 4;</code>
   */
  public boolean hasReadTime() {
    return readTime_ != null;
  }
  /**
   * <pre>
   * The time at which the document was read.
   * This may be monotically increasing, in this case the previous documents in
   * the result stream are guaranteed not to have changed between their
   * read_time and this one.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp read_time = 4;</code>
   */
  public com.google.protobuf.Timestamp getReadTime() {
    return readTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : readTime_;
  }
  /**
   * <pre>
   * The time at which the document was read.
   * This may be monotically increasing, in this case the previous documents in
   * the result stream are guaranteed not to have changed between their
   * read_time and this one.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp read_time = 4;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() {
    return getReadTime();
  }

  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (resultCase_ == 1) {
      output.writeMessage(1, (com.google.firestore.v1beta1.Document) result_);
    }
    if (resultCase_ == 2) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, result_);
    }
    if (!transaction_.isEmpty()) {
      output.writeBytes(3, transaction_);
    }
    if (readTime_ != null) {
      output.writeMessage(4, getReadTime());
    }
    unknownFields.writeTo(output);
  }

  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (resultCase_ == 1) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(1, (com.google.firestore.v1beta1.Document) result_);
    }
    if (resultCase_ == 2) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, result_);
    }
    if (!transaction_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(3, transaction_);
    }
    if (readTime_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(4, getReadTime());
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.google.firestore.v1beta1.BatchGetDocumentsResponse)) {
      return super.equals(obj);
    }
    com.google.firestore.v1beta1.BatchGetDocumentsResponse other = (com.google.firestore.v1beta1.BatchGetDocumentsResponse) obj;

    boolean result = true;
    result = result && getTransaction()
        .equals(other.getTransaction());
    result = result && (hasReadTime() == other.hasReadTime());
    if (hasReadTime()) {
      result = result && getReadTime()
          .equals(other.getReadTime());
    }
    result = result && getResultCase().equals(
        other.getResultCase());
    if (!result) return false;
    switch (resultCase_) {
      case 1:
        result = result && getFound()
            .equals(other.getFound());
        break;
      case 2:
        result = result && getMissing()
            .equals(other.getMissing());
        break;
      case 0:
      default:
    }
    result = result && unknownFields.equals(other.unknownFields);
    return result;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + TRANSACTION_FIELD_NUMBER;
    hash = (53 * hash) + getTransaction().hashCode();
    if (hasReadTime()) {
      hash = (37 * hash) + READ_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getReadTime().hashCode();
    }
    switch (resultCase_) {
      case 1:
        hash = (37 * hash) + FOUND_FIELD_NUMBER;
        hash = (53 * hash) + getFound().hashCode();
        break;
      case 2:
        hash = (37 * hash) + MISSING_FIELD_NUMBER;
        hash = (53 * hash) + getMissing().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.google.firestore.v1beta1.BatchGetDocumentsResponse prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * <pre>
   * The streamed response for [Firestore.BatchGetDocuments][google.firestore.v1beta1.Firestore.BatchGetDocuments].
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1beta1.BatchGetDocumentsResponse}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:google.firestore.v1beta1.BatchGetDocumentsResponse)
      com.google.firestore.v1beta1.BatchGetDocumentsResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.google.firestore.v1beta1.FirestoreProto.internal_static_google_firestore_v1beta1_BatchGetDocumentsResponse_descriptor;
    }

    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1beta1.FirestoreProto.internal_static_google_firestore_v1beta1_BatchGetDocumentsResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1beta1.BatchGetDocumentsResponse.class, com.google.firestore.v1beta1.BatchGetDocumentsResponse.Builder.class);
    }

    // Construct using com.google.firestore.v1beta1.BatchGetDocumentsResponse.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    public Builder clear() {
      super.clear();
      transaction_ = com.google.protobuf.ByteString.EMPTY;

      if (readTimeBuilder_ == null) {
        readTime_ = null;
      } else {
        readTime_ = null;
        readTimeBuilder_ = null;
      }
      resultCase_ = 0;
      result_ = null;
      return this;
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.google.firestore.v1beta1.FirestoreProto.internal_static_google_firestore_v1beta1_BatchGetDocumentsResponse_descriptor;
    }

    public com.google.firestore.v1beta1.BatchGetDocumentsResponse getDefaultInstanceForType() {
      return com.google.firestore.v1beta1.BatchGetDocumentsResponse.getDefaultInstance();
    }

    public com.google.firestore.v1beta1.BatchGetDocumentsResponse build() {
      com.google.firestore.v1beta1.BatchGetDocumentsResponse result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.google.firestore.v1beta1.BatchGetDocumentsResponse buildPartial() {
      com.google.firestore.v1beta1.BatchGetDocumentsResponse result = new com.google.firestore.v1beta1.BatchGetDocumentsResponse(this);
      if (resultCase_ == 1) {
        if (foundBuilder_ == null) {
          result.result_ = result_;
        } else {
          result.result_ = foundBuilder_.build();
        }
      }
      if (resultCase_ == 2) {
        result.result_ = result_;
      }
      result.transaction_ = transaction_;
      if (readTimeBuilder_ == null) {
        result.readTime_ = readTime_;
      } else {
        result.readTime_ = readTimeBuilder_.build();
      }
      result.resultCase_ = resultCase_;
      onBuilt();
      return result;
    }

    public Builder clone() {
      return (Builder) super.clone();
    }
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.setField(field, value);
    }
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return (Builder) super.clearField(field);
    }
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return (Builder) super.clearOneof(oneof);
    }
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return (Builder) super.setRepeatedField(field, index, value);
    }
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return (Builder) super.addRepeatedField(field, value);
    }
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.firestore.v1beta1.BatchGetDocumentsResponse) {
        return mergeFrom((com.google.firestore.v1beta1.BatchGetDocumentsResponse)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.firestore.v1beta1.BatchGetDocumentsResponse other) {
      if (other == com.google.firestore.v1beta1.BatchGetDocumentsResponse.getDefaultInstance()) return this;
      if (other.getTransaction() != com.google.protobuf.ByteString.EMPTY) {
        setTransaction(other.getTransaction());
      }
      if (other.hasReadTime()) {
        mergeReadTime(other.getReadTime());
      }
      switch (other.getResultCase()) {
        case FOUND: {
          mergeFound(other.getFound());
          break;
        }
        case MISSING: {
          resultCase_ = 2;
          result_ = other.result_;
          onChanged();
          break;
        }
        case RESULT_NOT_SET: {
          break;
        }
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.google.firestore.v1beta1.BatchGetDocumentsResponse parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.firestore.v1beta1.BatchGetDocumentsResponse) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int resultCase_ = 0;
    private java.lang.Object result_;
    public ResultCase
        getResultCase() {
      return ResultCase.forNumber(
          resultCase_);
    }

    public Builder clearResult() {
      resultCase_ = 0;
      result_ = null;
      onChanged();
      return this;
    }


    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.firestore.v1beta1.Document, com.google.firestore.v1beta1.Document.Builder, com.google.firestore.v1beta1.DocumentOrBuilder> foundBuilder_;
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public boolean hasFound() {
      return resultCase_ == 1;
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public com.google.firestore.v1beta1.Document getFound() {
      if (foundBuilder_ == null) {
        if (resultCase_ == 1) {
          return (com.google.firestore.v1beta1.Document) result_;
        }
        return com.google.firestore.v1beta1.Document.getDefaultInstance();
      } else {
        if (resultCase_ == 1) {
          return foundBuilder_.getMessage();
        }
        return com.google.firestore.v1beta1.Document.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public Builder setFound(com.google.firestore.v1beta1.Document value) {
      if (foundBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        result_ = value;
        onChanged();
      } else {
        foundBuilder_.setMessage(value);
      }
      resultCase_ = 1;
      return this;
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public Builder setFound(
        com.google.firestore.v1beta1.Document.Builder builderForValue) {
      if (foundBuilder_ == null) {
        result_ = builderForValue.build();
        onChanged();
      } else {
        foundBuilder_.setMessage(builderForValue.build());
      }
      resultCase_ = 1;
      return this;
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public Builder mergeFound(com.google.firestore.v1beta1.Document value) {
      if (foundBuilder_ == null) {
        if (resultCase_ == 1 &&
            result_ != com.google.firestore.v1beta1.Document.getDefaultInstance()) {
          result_ = com.google.firestore.v1beta1.Document.newBuilder((com.google.firestore.v1beta1.Document) result_)
              .mergeFrom(value).buildPartial();
        } else {
          result_ = value;
        }
        onChanged();
      } else {
        if (resultCase_ == 1) {
          foundBuilder_.mergeFrom(value);
        }
        foundBuilder_.setMessage(value);
      }
      resultCase_ = 1;
      return this;
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public Builder clearFound() {
      if (foundBuilder_ == null) {
        if (resultCase_ == 1) {
          resultCase_ = 0;
          result_ = null;
          onChanged();
        }
      } else {
        if (resultCase_ == 1) {
          resultCase_ = 0;
          result_ = null;
        }
        foundBuilder_.clear();
      }
      return this;
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public com.google.firestore.v1beta1.Document.Builder getFoundBuilder() {
      return getFoundFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    public com.google.firestore.v1beta1.DocumentOrBuilder getFoundOrBuilder() {
      if ((resultCase_ == 1) && (foundBuilder_ != null)) {
        return foundBuilder_.getMessageOrBuilder();
      } else {
        if (resultCase_ == 1) {
          return (com.google.firestore.v1beta1.Document) result_;
        }
        return com.google.firestore.v1beta1.Document.getDefaultInstance();
      }
    }
    /**
     * <pre>
     * A document that was requested.
     * </pre>
     *
     * <code>.google.firestore.v1beta1.Document found = 1;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.firestore.v1beta1.Document, com.google.firestore.v1beta1.Document.Builder, com.google.firestore.v1beta1.DocumentOrBuilder> 
        getFoundFieldBuilder() {
      if (foundBuilder_ == null) {
        if (!(resultCase_ == 1)) {
          result_ = com.google.firestore.v1beta1.Document.getDefaultInstance();
        }
        foundBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.firestore.v1beta1.Document, com.google.firestore.v1beta1.Document.Builder, com.google.firestore.v1beta1.DocumentOrBuilder>(
                (com.google.firestore.v1beta1.Document) result_,
                getParentForChildren(),
                isClean());
        result_ = null;
      }
      resultCase_ = 1;
      onChanged();;
      return foundBuilder_;
    }

    /**
     * <pre>
     * A document name that was requested but does not exist. In the format:
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
     * </pre>
     *
     * <code>string missing = 2;</code>
     */
    public java.lang.String getMissing() {
      java.lang.Object ref = "";
      if (resultCase_ == 2) {
        ref = result_;
      }
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (resultCase_ == 2) {
          result_ = s;
        }
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     * A document name that was requested but does not exist. In the format:
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
     * </pre>
     *
     * <code>string missing = 2;</code>
     */
    public com.google.protobuf.ByteString
        getMissingBytes() {
      java.lang.Object ref = "";
      if (resultCase_ == 2) {
        ref = result_;
      }
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        if (resultCase_ == 2) {
          result_ = b;
        }
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     * A document name that was requested but does not exist. In the format:
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
     * </pre>
     *
     * <code>string missing = 2;</code>
     */
    public Builder setMissing(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  resultCase_ = 2;
      result_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * A document name that was requested but does not exist. In the format:
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
     * </pre>
     *
     * <code>string missing = 2;</code>
     */
    public Builder clearMissing() {
      if (resultCase_ == 2) {
        resultCase_ = 0;
        result_ = null;
        onChanged();
      }
      return this;
    }
    /**
     * <pre>
     * A document name that was requested but does not exist. In the format:
     * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
     * </pre>
     *
     * <code>string missing = 2;</code>
     */
    public Builder setMissingBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      resultCase_ = 2;
      result_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString transaction_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <pre>
     * The transaction that was started as part of this request.
     * Will only be set in the first response, and only if
     * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
     * </pre>
     *
     * <code>bytes transaction = 3;</code>
     */
    public com.google.protobuf.ByteString getTransaction() {
      return transaction_;
    }
    /**
     * <pre>
     * The transaction that was started as part of this request.
     * Will only be set in the first response, and only if
     * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
     * </pre>
     *
     * <code>bytes transaction = 3;</code>
     */
    public Builder setTransaction(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      transaction_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     * The transaction that was started as part of this request.
     * Will only be set in the first response, and only if
     * [BatchGetDocumentsRequest.new_transaction][google.firestore.v1beta1.BatchGetDocumentsRequest.new_transaction] was set in the request.
     * </pre>
     *
     * <code>bytes transaction = 3;</code>
     */
    public Builder clearTransaction() {
      
      transaction_ = getDefaultInstance().getTransaction();
      onChanged();
      return this;
    }

    private com.google.protobuf.Timestamp readTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> readTimeBuilder_;
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public boolean hasReadTime() {
      return readTimeBuilder_ != null || readTime_ != null;
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public com.google.protobuf.Timestamp getReadTime() {
      if (readTimeBuilder_ == null) {
        return readTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : readTime_;
      } else {
        return readTimeBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public Builder setReadTime(com.google.protobuf.Timestamp value) {
      if (readTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        readTime_ = value;
        onChanged();
      } else {
        readTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public Builder setReadTime(
        com.google.protobuf.Timestamp.Builder builderForValue) {
      if (readTimeBuilder_ == null) {
        readTime_ = builderForValue.build();
        onChanged();
      } else {
        readTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public Builder mergeReadTime(com.google.protobuf.Timestamp value) {
      if (readTimeBuilder_ == null) {
        if (readTime_ != null) {
          readTime_ =
            com.google.protobuf.Timestamp.newBuilder(readTime_).mergeFrom(value).buildPartial();
        } else {
          readTime_ = value;
        }
        onChanged();
      } else {
        readTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public Builder clearReadTime() {
      if (readTimeBuilder_ == null) {
        readTime_ = null;
        onChanged();
      } else {
        readTime_ = null;
        readTimeBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public com.google.protobuf.Timestamp.Builder getReadTimeBuilder() {
      
      onChanged();
      return getReadTimeFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getReadTimeOrBuilder() {
      if (readTimeBuilder_ != null) {
        return readTimeBuilder_.getMessageOrBuilder();
      } else {
        return readTime_ == null ?
            com.google.protobuf.Timestamp.getDefaultInstance() : readTime_;
      }
    }
    /**
     * <pre>
     * The time at which the document was read.
     * This may be monotically increasing, in this case the previous documents in
     * the result stream are guaranteed not to have changed between their
     * read_time and this one.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp read_time = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder> 
        getReadTimeFieldBuilder() {
      if (readTimeBuilder_ == null) {
        readTimeBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp, com.google.protobuf.Timestamp.Builder, com.google.protobuf.TimestampOrBuilder>(
                getReadTime(),
                getParentForChildren(),
                isClean());
        readTime_ = null;
      }
      return readTimeBuilder_;
    }
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(unknownFields);
    }

    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:google.firestore.v1beta1.BatchGetDocumentsResponse)
  }

  // @@protoc_insertion_point(class_scope:google.firestore.v1beta1.BatchGetDocumentsResponse)
  private static final com.google.firestore.v1beta1.BatchGetDocumentsResponse DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.google.firestore.v1beta1.BatchGetDocumentsResponse();
  }

  public static com.google.firestore.v1beta1.BatchGetDocumentsResponse getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<BatchGetDocumentsResponse>
      PARSER = new com.google.protobuf.AbstractParser<BatchGetDocumentsResponse>() {
    public BatchGetDocumentsResponse parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new BatchGetDocumentsResponse(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<BatchGetDocumentsResponse> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<BatchGetDocumentsResponse> getParserForType() {
    return PARSER;
  }

  public com.google.firestore.v1beta1.BatchGetDocumentsResponse getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

