/*
 * Copyright 2020 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!
// source: google/cloud/tasks/v2beta2/task.proto

package com.google.cloud.tasks.v2beta2;

/**
 *
 *
 * <pre>
 * Status of the task.
 * </pre>
 *
 * Protobuf type {@code google.cloud.tasks.v2beta2.TaskStatus}
 */
public final class TaskStatus extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.tasks.v2beta2.TaskStatus)
    TaskStatusOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use TaskStatus.newBuilder() to construct.
  private TaskStatus(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private TaskStatus() {}

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
    return new TaskStatus();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
    return this.unknownFields;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.tasks.v2beta2.TaskProto
        .internal_static_google_cloud_tasks_v2beta2_TaskStatus_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.tasks.v2beta2.TaskProto
        .internal_static_google_cloud_tasks_v2beta2_TaskStatus_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.tasks.v2beta2.TaskStatus.class,
            com.google.cloud.tasks.v2beta2.TaskStatus.Builder.class);
  }

  public static final int ATTEMPT_DISPATCH_COUNT_FIELD_NUMBER = 1;
  private int attemptDispatchCount_ = 0;
  /**
   *
   *
   * <pre>
   * Output only. The number of attempts dispatched.
   * This count includes attempts which have been dispatched but haven't
   * received a response.
   * </pre>
   *
   * <code>int32 attempt_dispatch_count = 1;</code>
   *
   * @return The attemptDispatchCount.
   */
  @java.lang.Override
  public int getAttemptDispatchCount() {
    return attemptDispatchCount_;
  }

  public static final int ATTEMPT_RESPONSE_COUNT_FIELD_NUMBER = 2;
  private int attemptResponseCount_ = 0;
  /**
   *
   *
   * <pre>
   * Output only. The number of attempts which have received a response.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>int32 attempt_response_count = 2;</code>
   *
   * @return The attemptResponseCount.
   */
  @java.lang.Override
  public int getAttemptResponseCount() {
    return attemptResponseCount_;
  }

  public static final int FIRST_ATTEMPT_STATUS_FIELD_NUMBER = 3;
  private com.google.cloud.tasks.v2beta2.AttemptStatus firstAttemptStatus_;
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's first attempt.
   * Only
   * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
   * will be set. The other
   * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
   * not retained by Cloud Tasks.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
   *
   * @return Whether the firstAttemptStatus field is set.
   */
  @java.lang.Override
  public boolean hasFirstAttemptStatus() {
    return firstAttemptStatus_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's first attempt.
   * Only
   * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
   * will be set. The other
   * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
   * not retained by Cloud Tasks.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
   *
   * @return The firstAttemptStatus.
   */
  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.AttemptStatus getFirstAttemptStatus() {
    return firstAttemptStatus_ == null
        ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
        : firstAttemptStatus_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's first attempt.
   * Only
   * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
   * will be set. The other
   * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
   * not retained by Cloud Tasks.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
   */
  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder getFirstAttemptStatusOrBuilder() {
    return firstAttemptStatus_ == null
        ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
        : firstAttemptStatus_;
  }

  public static final int LAST_ATTEMPT_STATUS_FIELD_NUMBER = 4;
  private com.google.cloud.tasks.v2beta2.AttemptStatus lastAttemptStatus_;
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's last attempt.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
   *
   * @return Whether the lastAttemptStatus field is set.
   */
  @java.lang.Override
  public boolean hasLastAttemptStatus() {
    return lastAttemptStatus_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's last attempt.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
   *
   * @return The lastAttemptStatus.
   */
  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.AttemptStatus getLastAttemptStatus() {
    return lastAttemptStatus_ == null
        ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
        : lastAttemptStatus_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The status of the task's last attempt.
   * This field is not calculated for [pull
   * tasks][google.cloud.tasks.v2beta2.PullMessage].
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
   */
  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder getLastAttemptStatusOrBuilder() {
    return lastAttemptStatus_ == null
        ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
        : lastAttemptStatus_;
  }

  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 {
    if (attemptDispatchCount_ != 0) {
      output.writeInt32(1, attemptDispatchCount_);
    }
    if (attemptResponseCount_ != 0) {
      output.writeInt32(2, attemptResponseCount_);
    }
    if (firstAttemptStatus_ != null) {
      output.writeMessage(3, getFirstAttemptStatus());
    }
    if (lastAttemptStatus_ != null) {
      output.writeMessage(4, getLastAttemptStatus());
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (attemptDispatchCount_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, attemptDispatchCount_);
    }
    if (attemptResponseCount_ != 0) {
      size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, attemptResponseCount_);
    }
    if (firstAttemptStatus_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getFirstAttemptStatus());
    }
    if (lastAttemptStatus_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getLastAttemptStatus());
    }
    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.cloud.tasks.v2beta2.TaskStatus)) {
      return super.equals(obj);
    }
    com.google.cloud.tasks.v2beta2.TaskStatus other =
        (com.google.cloud.tasks.v2beta2.TaskStatus) obj;

    if (getAttemptDispatchCount() != other.getAttemptDispatchCount()) return false;
    if (getAttemptResponseCount() != other.getAttemptResponseCount()) return false;
    if (hasFirstAttemptStatus() != other.hasFirstAttemptStatus()) return false;
    if (hasFirstAttemptStatus()) {
      if (!getFirstAttemptStatus().equals(other.getFirstAttemptStatus())) return false;
    }
    if (hasLastAttemptStatus() != other.hasLastAttemptStatus()) return false;
    if (hasLastAttemptStatus()) {
      if (!getLastAttemptStatus().equals(other.getLastAttemptStatus())) 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();
    hash = (37 * hash) + ATTEMPT_DISPATCH_COUNT_FIELD_NUMBER;
    hash = (53 * hash) + getAttemptDispatchCount();
    hash = (37 * hash) + ATTEMPT_RESPONSE_COUNT_FIELD_NUMBER;
    hash = (53 * hash) + getAttemptResponseCount();
    if (hasFirstAttemptStatus()) {
      hash = (37 * hash) + FIRST_ATTEMPT_STATUS_FIELD_NUMBER;
      hash = (53 * hash) + getFirstAttemptStatus().hashCode();
    }
    if (hasLastAttemptStatus()) {
      hash = (37 * hash) + LAST_ATTEMPT_STATUS_FIELD_NUMBER;
      hash = (53 * hash) + getLastAttemptStatus().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus 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.cloud.tasks.v2beta2.TaskStatus parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus 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.cloud.tasks.v2beta2.TaskStatus parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.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.cloud.tasks.v2beta2.TaskStatus 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.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   *
   *
   * <pre>
   * Status of the task.
   * </pre>
   *
   * Protobuf type {@code google.cloud.tasks.v2beta2.TaskStatus}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.tasks.v2beta2.TaskStatus)
      com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.tasks.v2beta2.TaskProto
          .internal_static_google_cloud_tasks_v2beta2_TaskStatus_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.tasks.v2beta2.TaskProto
          .internal_static_google_cloud_tasks_v2beta2_TaskStatus_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.tasks.v2beta2.TaskStatus.class,
              com.google.cloud.tasks.v2beta2.TaskStatus.Builder.class);
    }

    // Construct using com.google.cloud.tasks.v2beta2.TaskStatus.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      attemptDispatchCount_ = 0;
      attemptResponseCount_ = 0;
      firstAttemptStatus_ = null;
      if (firstAttemptStatusBuilder_ != null) {
        firstAttemptStatusBuilder_.dispose();
        firstAttemptStatusBuilder_ = null;
      }
      lastAttemptStatus_ = null;
      if (lastAttemptStatusBuilder_ != null) {
        lastAttemptStatusBuilder_.dispose();
        lastAttemptStatusBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.tasks.v2beta2.TaskProto
          .internal_static_google_cloud_tasks_v2beta2_TaskStatus_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.TaskStatus getDefaultInstanceForType() {
      return com.google.cloud.tasks.v2beta2.TaskStatus.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.TaskStatus build() {
      com.google.cloud.tasks.v2beta2.TaskStatus result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.TaskStatus buildPartial() {
      com.google.cloud.tasks.v2beta2.TaskStatus result =
          new com.google.cloud.tasks.v2beta2.TaskStatus(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartial0(com.google.cloud.tasks.v2beta2.TaskStatus result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.attemptDispatchCount_ = attemptDispatchCount_;
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.attemptResponseCount_ = attemptResponseCount_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.firstAttemptStatus_ =
            firstAttemptStatusBuilder_ == null
                ? firstAttemptStatus_
                : firstAttemptStatusBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.lastAttemptStatus_ =
            lastAttemptStatusBuilder_ == null
                ? lastAttemptStatus_
                : lastAttemptStatusBuilder_.build();
      }
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }

    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.setField(field, value);
    }

    @java.lang.Override
    public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }

    @java.lang.Override
    public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }

    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }

    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.cloud.tasks.v2beta2.TaskStatus) {
        return mergeFrom((com.google.cloud.tasks.v2beta2.TaskStatus) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.tasks.v2beta2.TaskStatus other) {
      if (other == com.google.cloud.tasks.v2beta2.TaskStatus.getDefaultInstance()) return this;
      if (other.getAttemptDispatchCount() != 0) {
        setAttemptDispatchCount(other.getAttemptDispatchCount());
      }
      if (other.getAttemptResponseCount() != 0) {
        setAttemptResponseCount(other.getAttemptResponseCount());
      }
      if (other.hasFirstAttemptStatus()) {
        mergeFirstAttemptStatus(other.getFirstAttemptStatus());
      }
      if (other.hasLastAttemptStatus()) {
        mergeLastAttemptStatus(other.getLastAttemptStatus());
      }
      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 8:
              {
                attemptDispatchCount_ = input.readInt32();
                bitField0_ |= 0x00000001;
                break;
              } // case 8
            case 16:
              {
                attemptResponseCount_ = input.readInt32();
                bitField0_ |= 0x00000002;
                break;
              } // case 16
            case 26:
              {
                input.readMessage(
                    getFirstAttemptStatusFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            case 34:
              {
                input.readMessage(
                    getLastAttemptStatusFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000008;
                break;
              } // case 34
            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 int attemptDispatchCount_;
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts dispatched.
     * This count includes attempts which have been dispatched but haven't
     * received a response.
     * </pre>
     *
     * <code>int32 attempt_dispatch_count = 1;</code>
     *
     * @return The attemptDispatchCount.
     */
    @java.lang.Override
    public int getAttemptDispatchCount() {
      return attemptDispatchCount_;
    }
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts dispatched.
     * This count includes attempts which have been dispatched but haven't
     * received a response.
     * </pre>
     *
     * <code>int32 attempt_dispatch_count = 1;</code>
     *
     * @param value The attemptDispatchCount to set.
     * @return This builder for chaining.
     */
    public Builder setAttemptDispatchCount(int value) {

      attemptDispatchCount_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts dispatched.
     * This count includes attempts which have been dispatched but haven't
     * received a response.
     * </pre>
     *
     * <code>int32 attempt_dispatch_count = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearAttemptDispatchCount() {
      bitField0_ = (bitField0_ & ~0x00000001);
      attemptDispatchCount_ = 0;
      onChanged();
      return this;
    }

    private int attemptResponseCount_;
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts which have received a response.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>int32 attempt_response_count = 2;</code>
     *
     * @return The attemptResponseCount.
     */
    @java.lang.Override
    public int getAttemptResponseCount() {
      return attemptResponseCount_;
    }
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts which have received a response.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>int32 attempt_response_count = 2;</code>
     *
     * @param value The attemptResponseCount to set.
     * @return This builder for chaining.
     */
    public Builder setAttemptResponseCount(int value) {

      attemptResponseCount_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The number of attempts which have received a response.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>int32 attempt_response_count = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearAttemptResponseCount() {
      bitField0_ = (bitField0_ & ~0x00000002);
      attemptResponseCount_ = 0;
      onChanged();
      return this;
    }

    private com.google.cloud.tasks.v2beta2.AttemptStatus firstAttemptStatus_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AttemptStatus,
            com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
            com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>
        firstAttemptStatusBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     *
     * @return Whether the firstAttemptStatus field is set.
     */
    public boolean hasFirstAttemptStatus() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     *
     * @return The firstAttemptStatus.
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatus getFirstAttemptStatus() {
      if (firstAttemptStatusBuilder_ == null) {
        return firstAttemptStatus_ == null
            ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
            : firstAttemptStatus_;
      } else {
        return firstAttemptStatusBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public Builder setFirstAttemptStatus(com.google.cloud.tasks.v2beta2.AttemptStatus value) {
      if (firstAttemptStatusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        firstAttemptStatus_ = value;
      } else {
        firstAttemptStatusBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public Builder setFirstAttemptStatus(
        com.google.cloud.tasks.v2beta2.AttemptStatus.Builder builderForValue) {
      if (firstAttemptStatusBuilder_ == null) {
        firstAttemptStatus_ = builderForValue.build();
      } else {
        firstAttemptStatusBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public Builder mergeFirstAttemptStatus(com.google.cloud.tasks.v2beta2.AttemptStatus value) {
      if (firstAttemptStatusBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && firstAttemptStatus_ != null
            && firstAttemptStatus_
                != com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()) {
          getFirstAttemptStatusBuilder().mergeFrom(value);
        } else {
          firstAttemptStatus_ = value;
        }
      } else {
        firstAttemptStatusBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public Builder clearFirstAttemptStatus() {
      bitField0_ = (bitField0_ & ~0x00000004);
      firstAttemptStatus_ = null;
      if (firstAttemptStatusBuilder_ != null) {
        firstAttemptStatusBuilder_.dispose();
        firstAttemptStatusBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatus.Builder getFirstAttemptStatusBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return getFirstAttemptStatusFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder getFirstAttemptStatusOrBuilder() {
      if (firstAttemptStatusBuilder_ != null) {
        return firstAttemptStatusBuilder_.getMessageOrBuilder();
      } else {
        return firstAttemptStatus_ == null
            ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
            : firstAttemptStatus_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's first attempt.
     * Only
     * [dispatch_time][google.cloud.tasks.v2beta2.AttemptStatus.dispatch_time]
     * will be set. The other
     * [AttemptStatus][google.cloud.tasks.v2beta2.AttemptStatus] information is
     * not retained by Cloud Tasks.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus first_attempt_status = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AttemptStatus,
            com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
            com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>
        getFirstAttemptStatusFieldBuilder() {
      if (firstAttemptStatusBuilder_ == null) {
        firstAttemptStatusBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.AttemptStatus,
                com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
                com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>(
                getFirstAttemptStatus(), getParentForChildren(), isClean());
        firstAttemptStatus_ = null;
      }
      return firstAttemptStatusBuilder_;
    }

    private com.google.cloud.tasks.v2beta2.AttemptStatus lastAttemptStatus_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AttemptStatus,
            com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
            com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>
        lastAttemptStatusBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     *
     * @return Whether the lastAttemptStatus field is set.
     */
    public boolean hasLastAttemptStatus() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     *
     * @return The lastAttemptStatus.
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatus getLastAttemptStatus() {
      if (lastAttemptStatusBuilder_ == null) {
        return lastAttemptStatus_ == null
            ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
            : lastAttemptStatus_;
      } else {
        return lastAttemptStatusBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public Builder setLastAttemptStatus(com.google.cloud.tasks.v2beta2.AttemptStatus value) {
      if (lastAttemptStatusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        lastAttemptStatus_ = value;
      } else {
        lastAttemptStatusBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public Builder setLastAttemptStatus(
        com.google.cloud.tasks.v2beta2.AttemptStatus.Builder builderForValue) {
      if (lastAttemptStatusBuilder_ == null) {
        lastAttemptStatus_ = builderForValue.build();
      } else {
        lastAttemptStatusBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public Builder mergeLastAttemptStatus(com.google.cloud.tasks.v2beta2.AttemptStatus value) {
      if (lastAttemptStatusBuilder_ == null) {
        if (((bitField0_ & 0x00000008) != 0)
            && lastAttemptStatus_ != null
            && lastAttemptStatus_
                != com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()) {
          getLastAttemptStatusBuilder().mergeFrom(value);
        } else {
          lastAttemptStatus_ = value;
        }
      } else {
        lastAttemptStatusBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public Builder clearLastAttemptStatus() {
      bitField0_ = (bitField0_ & ~0x00000008);
      lastAttemptStatus_ = null;
      if (lastAttemptStatusBuilder_ != null) {
        lastAttemptStatusBuilder_.dispose();
        lastAttemptStatusBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatus.Builder getLastAttemptStatusBuilder() {
      bitField0_ |= 0x00000008;
      onChanged();
      return getLastAttemptStatusFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    public com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder getLastAttemptStatusOrBuilder() {
      if (lastAttemptStatusBuilder_ != null) {
        return lastAttemptStatusBuilder_.getMessageOrBuilder();
      } else {
        return lastAttemptStatus_ == null
            ? com.google.cloud.tasks.v2beta2.AttemptStatus.getDefaultInstance()
            : lastAttemptStatus_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The status of the task's last attempt.
     * This field is not calculated for [pull
     * tasks][google.cloud.tasks.v2beta2.PullMessage].
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AttemptStatus last_attempt_status = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AttemptStatus,
            com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
            com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>
        getLastAttemptStatusFieldBuilder() {
      if (lastAttemptStatusBuilder_ == null) {
        lastAttemptStatusBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.AttemptStatus,
                com.google.cloud.tasks.v2beta2.AttemptStatus.Builder,
                com.google.cloud.tasks.v2beta2.AttemptStatusOrBuilder>(
                getLastAttemptStatus(), getParentForChildren(), isClean());
        lastAttemptStatus_ = null;
      }
      return lastAttemptStatusBuilder_;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

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

    // @@protoc_insertion_point(builder_scope:google.cloud.tasks.v2beta2.TaskStatus)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.tasks.v2beta2.TaskStatus)
  private static final com.google.cloud.tasks.v2beta2.TaskStatus DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.tasks.v2beta2.TaskStatus();
  }

  public static com.google.cloud.tasks.v2beta2.TaskStatus getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TaskStatus> PARSER =
      new com.google.protobuf.AbstractParser<TaskStatus>() {
        @java.lang.Override
        public TaskStatus 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<TaskStatus> parser() {
    return PARSER;
  }

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

  @java.lang.Override
  public com.google.cloud.tasks.v2beta2.TaskStatus getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
