/*
 * Copyright 2026 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
 *
 *     https://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!
// NO CHECKED-IN PROTOBUF GENCODE
// source: google/firestore/v1/firestore.proto
// Protobuf Java Version: 4.33.2

package com.google.firestore.v1;

/**
 *
 *
 * <pre>
 * The response from
 * [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].
 * </pre>
 *
 * Protobuf type {@code google.firestore.v1.BatchWriteResponse}
 */
@com.google.protobuf.Generated
public final class BatchWriteResponse extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.firestore.v1.BatchWriteResponse)
    BatchWriteResponseOrBuilder {
  private static final long serialVersionUID = 0L;

  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
        /* major= */ 4,
        /* minor= */ 33,
        /* patch= */ 2,
        /* suffix= */ "",
        "BatchWriteResponse");
  }

  // Use BatchWriteResponse.newBuilder() to construct.
  private BatchWriteResponse(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }

  private BatchWriteResponse() {
    writeResults_ = java.util.Collections.emptyList();
    status_ = java.util.Collections.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.firestore.v1.FirestoreProto
        .internal_static_google_firestore_v1_BatchWriteResponse_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.firestore.v1.FirestoreProto
        .internal_static_google_firestore_v1_BatchWriteResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.firestore.v1.BatchWriteResponse.class,
            com.google.firestore.v1.BatchWriteResponse.Builder.class);
  }

  public static final int WRITE_RESULTS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private java.util.List<com.google.firestore.v1.WriteResult> writeResults_;

  /**
   *
   *
   * <pre>
   * The result of applying the writes.
   *
   * This i-th write result corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.firestore.v1.WriteResult> getWriteResultsList() {
    return writeResults_;
  }

  /**
   *
   *
   * <pre>
   * The result of applying the writes.
   *
   * This i-th write result corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.firestore.v1.WriteResultOrBuilder>
      getWriteResultsOrBuilderList() {
    return writeResults_;
  }

  /**
   *
   *
   * <pre>
   * The result of applying the writes.
   *
   * This i-th write result corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
   */
  @java.lang.Override
  public int getWriteResultsCount() {
    return writeResults_.size();
  }

  /**
   *
   *
   * <pre>
   * The result of applying the writes.
   *
   * This i-th write result corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.WriteResult getWriteResults(int index) {
    return writeResults_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The result of applying the writes.
   *
   * This i-th write result corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
   */
  @java.lang.Override
  public com.google.firestore.v1.WriteResultOrBuilder getWriteResultsOrBuilder(int index) {
    return writeResults_.get(index);
  }

  public static final int STATUS_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private java.util.List<com.google.rpc.Status> status_;

  /**
   *
   *
   * <pre>
   * The status of applying the writes.
   *
   * This i-th write status corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.rpc.Status status = 2;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.rpc.Status> getStatusList() {
    return status_;
  }

  /**
   *
   *
   * <pre>
   * The status of applying the writes.
   *
   * This i-th write status corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.rpc.Status status = 2;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.rpc.StatusOrBuilder> getStatusOrBuilderList() {
    return status_;
  }

  /**
   *
   *
   * <pre>
   * The status of applying the writes.
   *
   * This i-th write status corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.rpc.Status status = 2;</code>
   */
  @java.lang.Override
  public int getStatusCount() {
    return status_.size();
  }

  /**
   *
   *
   * <pre>
   * The status of applying the writes.
   *
   * This i-th write status corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.rpc.Status status = 2;</code>
   */
  @java.lang.Override
  public com.google.rpc.Status getStatus(int index) {
    return status_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The status of applying the writes.
   *
   * This i-th write status corresponds to the i-th write in the
   * request.
   * </pre>
   *
   * <code>repeated .google.rpc.Status status = 2;</code>
   */
  @java.lang.Override
  public com.google.rpc.StatusOrBuilder getStatusOrBuilder(int index) {
    return status_.get(index);
  }

  private byte memoizedIsInitialized = -1;

  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    for (int i = 0; i < writeResults_.size(); i++) {
      output.writeMessage(1, writeResults_.get(i));
    }
    for (int i = 0; i < status_.size(); i++) {
      output.writeMessage(2, status_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    for (int i = 0; i < writeResults_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, writeResults_.get(i));
    }
    for (int i = 0; i < status_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, status_.get(i));
    }
    size += getUnknownFields().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.v1.BatchWriteResponse)) {
      return super.equals(obj);
    }
    com.google.firestore.v1.BatchWriteResponse other =
        (com.google.firestore.v1.BatchWriteResponse) obj;

    if (!getWriteResultsList().equals(other.getWriteResultsList())) return false;
    if (!getStatusList().equals(other.getStatusList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (getWriteResultsCount() > 0) {
      hash = (37 * hash) + WRITE_RESULTS_FIELD_NUMBER;
      hash = (53 * hash) + getWriteResultsList().hashCode();
    }
    if (getStatusCount() > 0) {
      hash = (37 * hash) + STATUS_FIELD_NUMBER;
      hash = (53 * hash) + getStatusList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.BatchWriteResponse 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.v1.BatchWriteResponse parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.BatchWriteResponse 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.v1.BatchWriteResponse parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.firestore.v1.BatchWriteResponse parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.firestore.v1.BatchWriteResponse prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * The response from
   * [Firestore.BatchWrite][google.firestore.v1.Firestore.BatchWrite].
   * </pre>
   *
   * Protobuf type {@code google.firestore.v1.BatchWriteResponse}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.firestore.v1.BatchWriteResponse)
      com.google.firestore.v1.BatchWriteResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.firestore.v1.FirestoreProto
          .internal_static_google_firestore_v1_BatchWriteResponse_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.firestore.v1.FirestoreProto
          .internal_static_google_firestore_v1_BatchWriteResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.firestore.v1.BatchWriteResponse.class,
              com.google.firestore.v1.BatchWriteResponse.Builder.class);
    }

    // Construct using com.google.firestore.v1.BatchWriteResponse.newBuilder()
    private Builder() {}

    private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (writeResultsBuilder_ == null) {
        writeResults_ = java.util.Collections.emptyList();
      } else {
        writeResults_ = null;
        writeResultsBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      if (statusBuilder_ == null) {
        status_ = java.util.Collections.emptyList();
      } else {
        status_ = null;
        statusBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.firestore.v1.FirestoreProto
          .internal_static_google_firestore_v1_BatchWriteResponse_descriptor;
    }

    @java.lang.Override
    public com.google.firestore.v1.BatchWriteResponse getDefaultInstanceForType() {
      return com.google.firestore.v1.BatchWriteResponse.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.firestore.v1.BatchWriteResponse build() {
      com.google.firestore.v1.BatchWriteResponse result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.firestore.v1.BatchWriteResponse buildPartial() {
      com.google.firestore.v1.BatchWriteResponse result =
          new com.google.firestore.v1.BatchWriteResponse(this);
      buildPartialRepeatedFields(result);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartialRepeatedFields(com.google.firestore.v1.BatchWriteResponse result) {
      if (writeResultsBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          writeResults_ = java.util.Collections.unmodifiableList(writeResults_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.writeResults_ = writeResults_;
      } else {
        result.writeResults_ = writeResultsBuilder_.build();
      }
      if (statusBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          status_ = java.util.Collections.unmodifiableList(status_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.status_ = status_;
      } else {
        result.status_ = statusBuilder_.build();
      }
    }

    private void buildPartial0(com.google.firestore.v1.BatchWriteResponse result) {
      int from_bitField0_ = bitField0_;
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.firestore.v1.BatchWriteResponse) {
        return mergeFrom((com.google.firestore.v1.BatchWriteResponse) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.firestore.v1.BatchWriteResponse other) {
      if (other == com.google.firestore.v1.BatchWriteResponse.getDefaultInstance()) return this;
      if (writeResultsBuilder_ == null) {
        if (!other.writeResults_.isEmpty()) {
          if (writeResults_.isEmpty()) {
            writeResults_ = other.writeResults_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureWriteResultsIsMutable();
            writeResults_.addAll(other.writeResults_);
          }
          onChanged();
        }
      } else {
        if (!other.writeResults_.isEmpty()) {
          if (writeResultsBuilder_.isEmpty()) {
            writeResultsBuilder_.dispose();
            writeResultsBuilder_ = null;
            writeResults_ = other.writeResults_;
            bitField0_ = (bitField0_ & ~0x00000001);
            writeResultsBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetWriteResultsFieldBuilder()
                    : null;
          } else {
            writeResultsBuilder_.addAllMessages(other.writeResults_);
          }
        }
      }
      if (statusBuilder_ == null) {
        if (!other.status_.isEmpty()) {
          if (status_.isEmpty()) {
            status_ = other.status_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureStatusIsMutable();
            status_.addAll(other.status_);
          }
          onChanged();
        }
      } else {
        if (!other.status_.isEmpty()) {
          if (statusBuilder_.isEmpty()) {
            statusBuilder_.dispose();
            statusBuilder_ = null;
            status_ = other.status_;
            bitField0_ = (bitField0_ & ~0x00000002);
            statusBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetStatusFieldBuilder()
                    : null;
          } else {
            statusBuilder_.addAllMessages(other.status_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                com.google.firestore.v1.WriteResult m =
                    input.readMessage(
                        com.google.firestore.v1.WriteResult.parser(), extensionRegistry);
                if (writeResultsBuilder_ == null) {
                  ensureWriteResultsIsMutable();
                  writeResults_.add(m);
                } else {
                  writeResultsBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 18:
              {
                com.google.rpc.Status m =
                    input.readMessage(com.google.rpc.Status.parser(), extensionRegistry);
                if (statusBuilder_ == null) {
                  ensureStatusIsMutable();
                  status_.add(m);
                } else {
                  statusBuilder_.addMessage(m);
                }
                break;
              } // case 18
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private java.util.List<com.google.firestore.v1.WriteResult> writeResults_ =
        java.util.Collections.emptyList();

    private void ensureWriteResultsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        writeResults_ = new java.util.ArrayList<com.google.firestore.v1.WriteResult>(writeResults_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.WriteResult,
            com.google.firestore.v1.WriteResult.Builder,
            com.google.firestore.v1.WriteResultOrBuilder>
        writeResultsBuilder_;

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public java.util.List<com.google.firestore.v1.WriteResult> getWriteResultsList() {
      if (writeResultsBuilder_ == null) {
        return java.util.Collections.unmodifiableList(writeResults_);
      } else {
        return writeResultsBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public int getWriteResultsCount() {
      if (writeResultsBuilder_ == null) {
        return writeResults_.size();
      } else {
        return writeResultsBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public com.google.firestore.v1.WriteResult getWriteResults(int index) {
      if (writeResultsBuilder_ == null) {
        return writeResults_.get(index);
      } else {
        return writeResultsBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder setWriteResults(int index, com.google.firestore.v1.WriteResult value) {
      if (writeResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureWriteResultsIsMutable();
        writeResults_.set(index, value);
        onChanged();
      } else {
        writeResultsBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder setWriteResults(
        int index, com.google.firestore.v1.WriteResult.Builder builderForValue) {
      if (writeResultsBuilder_ == null) {
        ensureWriteResultsIsMutable();
        writeResults_.set(index, builderForValue.build());
        onChanged();
      } else {
        writeResultsBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder addWriteResults(com.google.firestore.v1.WriteResult value) {
      if (writeResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureWriteResultsIsMutable();
        writeResults_.add(value);
        onChanged();
      } else {
        writeResultsBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder addWriteResults(int index, com.google.firestore.v1.WriteResult value) {
      if (writeResultsBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureWriteResultsIsMutable();
        writeResults_.add(index, value);
        onChanged();
      } else {
        writeResultsBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder addWriteResults(com.google.firestore.v1.WriteResult.Builder builderForValue) {
      if (writeResultsBuilder_ == null) {
        ensureWriteResultsIsMutable();
        writeResults_.add(builderForValue.build());
        onChanged();
      } else {
        writeResultsBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder addWriteResults(
        int index, com.google.firestore.v1.WriteResult.Builder builderForValue) {
      if (writeResultsBuilder_ == null) {
        ensureWriteResultsIsMutable();
        writeResults_.add(index, builderForValue.build());
        onChanged();
      } else {
        writeResultsBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder addAllWriteResults(
        java.lang.Iterable<? extends com.google.firestore.v1.WriteResult> values) {
      if (writeResultsBuilder_ == null) {
        ensureWriteResultsIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, writeResults_);
        onChanged();
      } else {
        writeResultsBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder clearWriteResults() {
      if (writeResultsBuilder_ == null) {
        writeResults_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        writeResultsBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public Builder removeWriteResults(int index) {
      if (writeResultsBuilder_ == null) {
        ensureWriteResultsIsMutable();
        writeResults_.remove(index);
        onChanged();
      } else {
        writeResultsBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public com.google.firestore.v1.WriteResult.Builder getWriteResultsBuilder(int index) {
      return internalGetWriteResultsFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public com.google.firestore.v1.WriteResultOrBuilder getWriteResultsOrBuilder(int index) {
      if (writeResultsBuilder_ == null) {
        return writeResults_.get(index);
      } else {
        return writeResultsBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public java.util.List<? extends com.google.firestore.v1.WriteResultOrBuilder>
        getWriteResultsOrBuilderList() {
      if (writeResultsBuilder_ != null) {
        return writeResultsBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(writeResults_);
      }
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public com.google.firestore.v1.WriteResult.Builder addWriteResultsBuilder() {
      return internalGetWriteResultsFieldBuilder()
          .addBuilder(com.google.firestore.v1.WriteResult.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public com.google.firestore.v1.WriteResult.Builder addWriteResultsBuilder(int index) {
      return internalGetWriteResultsFieldBuilder()
          .addBuilder(index, com.google.firestore.v1.WriteResult.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The result of applying the writes.
     *
     * This i-th write result corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.firestore.v1.WriteResult write_results = 1;</code>
     */
    public java.util.List<com.google.firestore.v1.WriteResult.Builder>
        getWriteResultsBuilderList() {
      return internalGetWriteResultsFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.firestore.v1.WriteResult,
            com.google.firestore.v1.WriteResult.Builder,
            com.google.firestore.v1.WriteResultOrBuilder>
        internalGetWriteResultsFieldBuilder() {
      if (writeResultsBuilder_ == null) {
        writeResultsBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.firestore.v1.WriteResult,
                com.google.firestore.v1.WriteResult.Builder,
                com.google.firestore.v1.WriteResultOrBuilder>(
                writeResults_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
        writeResults_ = null;
      }
      return writeResultsBuilder_;
    }

    private java.util.List<com.google.rpc.Status> status_ = java.util.Collections.emptyList();

    private void ensureStatusIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        status_ = new java.util.ArrayList<com.google.rpc.Status>(status_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>
        statusBuilder_;

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public java.util.List<com.google.rpc.Status> getStatusList() {
      if (statusBuilder_ == null) {
        return java.util.Collections.unmodifiableList(status_);
      } else {
        return statusBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public int getStatusCount() {
      if (statusBuilder_ == null) {
        return status_.size();
      } else {
        return statusBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public com.google.rpc.Status getStatus(int index) {
      if (statusBuilder_ == null) {
        return status_.get(index);
      } else {
        return statusBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder setStatus(int index, com.google.rpc.Status value) {
      if (statusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatusIsMutable();
        status_.set(index, value);
        onChanged();
      } else {
        statusBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder setStatus(int index, com.google.rpc.Status.Builder builderForValue) {
      if (statusBuilder_ == null) {
        ensureStatusIsMutable();
        status_.set(index, builderForValue.build());
        onChanged();
      } else {
        statusBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder addStatus(com.google.rpc.Status value) {
      if (statusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatusIsMutable();
        status_.add(value);
        onChanged();
      } else {
        statusBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder addStatus(int index, com.google.rpc.Status value) {
      if (statusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureStatusIsMutable();
        status_.add(index, value);
        onChanged();
      } else {
        statusBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder addStatus(com.google.rpc.Status.Builder builderForValue) {
      if (statusBuilder_ == null) {
        ensureStatusIsMutable();
        status_.add(builderForValue.build());
        onChanged();
      } else {
        statusBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder addStatus(int index, com.google.rpc.Status.Builder builderForValue) {
      if (statusBuilder_ == null) {
        ensureStatusIsMutable();
        status_.add(index, builderForValue.build());
        onChanged();
      } else {
        statusBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder addAllStatus(java.lang.Iterable<? extends com.google.rpc.Status> values) {
      if (statusBuilder_ == null) {
        ensureStatusIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, status_);
        onChanged();
      } else {
        statusBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder clearStatus() {
      if (statusBuilder_ == null) {
        status_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        statusBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public Builder removeStatus(int index) {
      if (statusBuilder_ == null) {
        ensureStatusIsMutable();
        status_.remove(index);
        onChanged();
      } else {
        statusBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public com.google.rpc.Status.Builder getStatusBuilder(int index) {
      return internalGetStatusFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public com.google.rpc.StatusOrBuilder getStatusOrBuilder(int index) {
      if (statusBuilder_ == null) {
        return status_.get(index);
      } else {
        return statusBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public java.util.List<? extends com.google.rpc.StatusOrBuilder> getStatusOrBuilderList() {
      if (statusBuilder_ != null) {
        return statusBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(status_);
      }
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public com.google.rpc.Status.Builder addStatusBuilder() {
      return internalGetStatusFieldBuilder().addBuilder(com.google.rpc.Status.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public com.google.rpc.Status.Builder addStatusBuilder(int index) {
      return internalGetStatusFieldBuilder()
          .addBuilder(index, com.google.rpc.Status.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The status of applying the writes.
     *
     * This i-th write status corresponds to the i-th write in the
     * request.
     * </pre>
     *
     * <code>repeated .google.rpc.Status status = 2;</code>
     */
    public java.util.List<com.google.rpc.Status.Builder> getStatusBuilderList() {
      return internalGetStatusFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder>
        internalGetStatusFieldBuilder() {
      if (statusBuilder_ == null) {
        statusBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.rpc.Status,
                com.google.rpc.Status.Builder,
                com.google.rpc.StatusOrBuilder>(
                status_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean());
        status_ = null;
      }
      return statusBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.firestore.v1.BatchWriteResponse)
  }

  // @@protoc_insertion_point(class_scope:google.firestore.v1.BatchWriteResponse)
  private static final com.google.firestore.v1.BatchWriteResponse DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.firestore.v1.BatchWriteResponse();
  }

  public static com.google.firestore.v1.BatchWriteResponse getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<BatchWriteResponse> PARSER =
      new com.google.protobuf.AbstractParser<BatchWriteResponse>() {
        @java.lang.Override
        public BatchWriteResponse parsePartialFrom(
            com.google.protobuf.CodedInputStream input,
            com.google.protobuf.ExtensionRegistryLite extensionRegistry)
            throws com.google.protobuf.InvalidProtocolBufferException {
          Builder builder = newBuilder();
          try {
            builder.mergeFrom(input, extensionRegistry);
          } catch (com.google.protobuf.InvalidProtocolBufferException e) {
            throw e.setUnfinishedMessage(builder.buildPartial());
          } catch (com.google.protobuf.UninitializedMessageException e) {
            throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
          } catch (java.io.IOException e) {
            throw new com.google.protobuf.InvalidProtocolBufferException(e)
                .setUnfinishedMessage(builder.buildPartial());
          }
          return builder.buildPartial();
        }
      };

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

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

  @java.lang.Override
  public com.google.firestore.v1.BatchWriteResponse getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
