// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/tasks/v2beta2/task.proto

package com.google.cloud.tasks.v2beta2;

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

  private Task() {
    name_ = "";
    view_ = 0;
  }

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

  private Task(
      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;
          case 10:
            {
              java.lang.String s = input.readStringRequireUtf8();

              name_ = s;
              break;
            }
          case 26:
            {
              com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder subBuilder = null;
              if (payloadTypeCase_ == 3) {
                subBuilder =
                    ((com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_)
                        .toBuilder();
              }
              payloadType_ =
                  input.readMessage(
                      com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.parser(),
                      extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(
                    (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_);
                payloadType_ = subBuilder.buildPartial();
              }
              payloadTypeCase_ = 3;
              break;
            }
          case 34:
            {
              com.google.cloud.tasks.v2beta2.PullMessage.Builder subBuilder = null;
              if (payloadTypeCase_ == 4) {
                subBuilder =
                    ((com.google.cloud.tasks.v2beta2.PullMessage) payloadType_).toBuilder();
              }
              payloadType_ =
                  input.readMessage(
                      com.google.cloud.tasks.v2beta2.PullMessage.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom((com.google.cloud.tasks.v2beta2.PullMessage) payloadType_);
                payloadType_ = subBuilder.buildPartial();
              }
              payloadTypeCase_ = 4;
              break;
            }
          case 42:
            {
              com.google.protobuf.Timestamp.Builder subBuilder = null;
              if (scheduleTime_ != null) {
                subBuilder = scheduleTime_.toBuilder();
              }
              scheduleTime_ =
                  input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(scheduleTime_);
                scheduleTime_ = subBuilder.buildPartial();
              }

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

              break;
            }
          case 58:
            {
              com.google.cloud.tasks.v2beta2.TaskStatus.Builder subBuilder = null;
              if (status_ != null) {
                subBuilder = status_.toBuilder();
              }
              status_ =
                  input.readMessage(
                      com.google.cloud.tasks.v2beta2.TaskStatus.parser(), extensionRegistry);
              if (subBuilder != null) {
                subBuilder.mergeFrom(status_);
                status_ = subBuilder.buildPartial();
              }

              break;
            }
          case 64:
            {
              int rawValue = input.readEnum();

              view_ = rawValue;
              break;
            }
          default:
            {
              if (!parseUnknownFieldProto3(input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              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.cloud.tasks.v2beta2.TaskProto
        .internal_static_google_cloud_tasks_v2beta2_Task_descriptor;
  }

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

  /**
   *
   *
   * <pre>
   * The view specifies a subset of [Task][google.cloud.tasks.v2beta2.Task] data.
   * When a task is returned in a response, not all
   * information is retrieved by default because some data, such as
   * payloads, might be desirable to return only when needed because
   * of its large size or because of the sensitivity of data that it
   * contains.
   * </pre>
   *
   * Protobuf enum {@code google.cloud.tasks.v2beta2.Task.View}
   */
  public enum View implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * Unspecified. Defaults to BASIC.
     * </pre>
     *
     * <code>VIEW_UNSPECIFIED = 0;</code>
     */
    VIEW_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * The basic view omits fields which can be large or can contain
     * sensitive data.
     * This view does not include the
     * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and
     * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are
     * desirable to return only when needed, because they can be large
     * and because of the sensitivity of the data that you choose to
     * store in it.
     * </pre>
     *
     * <code>BASIC = 1;</code>
     */
    BASIC(1),
    /**
     *
     *
     * <pre>
     * All information is returned.
     * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires
     * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource.
     * </pre>
     *
     * <code>FULL = 2;</code>
     */
    FULL(2),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * Unspecified. Defaults to BASIC.
     * </pre>
     *
     * <code>VIEW_UNSPECIFIED = 0;</code>
     */
    public static final int VIEW_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * The basic view omits fields which can be large or can contain
     * sensitive data.
     * This view does not include the
     * ([payload in AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] and
     * [payload in PullMessage][google.cloud.tasks.v2beta2.PullMessage.payload]). These payloads are
     * desirable to return only when needed, because they can be large
     * and because of the sensitivity of the data that you choose to
     * store in it.
     * </pre>
     *
     * <code>BASIC = 1;</code>
     */
    public static final int BASIC_VALUE = 1;
    /**
     *
     *
     * <pre>
     * All information is returned.
     * Authorization for [FULL][google.cloud.tasks.v2beta2.Task.View.FULL] requires
     * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/)
     * permission on the [Queue][google.cloud.tasks.v2beta2.Queue] resource.
     * </pre>
     *
     * <code>FULL = 2;</code>
     */
    public static final int FULL_VALUE = 2;

    public final int getNumber() {
      if (this == UNRECOGNIZED) {
        throw new java.lang.IllegalArgumentException(
            "Can't get the number of an unknown enum value.");
      }
      return value;
    }

    /** @deprecated Use {@link #forNumber(int)} instead. */
    @java.lang.Deprecated
    public static View valueOf(int value) {
      return forNumber(value);
    }

    public static View forNumber(int value) {
      switch (value) {
        case 0:
          return VIEW_UNSPECIFIED;
        case 1:
          return BASIC;
        case 2:
          return FULL;
        default:
          return null;
      }
    }

    public static com.google.protobuf.Internal.EnumLiteMap<View> internalGetValueMap() {
      return internalValueMap;
    }

    private static final com.google.protobuf.Internal.EnumLiteMap<View> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<View>() {
          public View findValueByNumber(int number) {
            return View.forNumber(number);
          }
        };

    public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() {
      return getDescriptor().getValues().get(ordinal());
    }

    public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() {
      return getDescriptor();
    }

    public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() {
      return com.google.cloud.tasks.v2beta2.Task.getDescriptor().getEnumTypes().get(0);
    }

    private static final View[] VALUES = values();

    public static View valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
      if (desc.getType() != getDescriptor()) {
        throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type.");
      }
      if (desc.getIndex() == -1) {
        return UNRECOGNIZED;
      }
      return VALUES[desc.getIndex()];
    }

    private final int value;

    private View(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.cloud.tasks.v2beta2.Task.View)
  }

  private int payloadTypeCase_ = 0;
  private java.lang.Object payloadType_;

  public enum PayloadTypeCase implements com.google.protobuf.Internal.EnumLite {
    APP_ENGINE_HTTP_REQUEST(3),
    PULL_MESSAGE(4),
    PAYLOADTYPE_NOT_SET(0);
    private final int value;

    private PayloadTypeCase(int value) {
      this.value = value;
    }
    /** @deprecated Use {@link #forNumber(int)} instead. */
    @java.lang.Deprecated
    public static PayloadTypeCase valueOf(int value) {
      return forNumber(value);
    }

    public static PayloadTypeCase forNumber(int value) {
      switch (value) {
        case 3:
          return APP_ENGINE_HTTP_REQUEST;
        case 4:
          return PULL_MESSAGE;
        case 0:
          return PAYLOADTYPE_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public PayloadTypeCase getPayloadTypeCase() {
    return PayloadTypeCase.forNumber(payloadTypeCase_);
  }

  public static final int NAME_FIELD_NUMBER = 1;
  private volatile java.lang.Object name_;
  /**
   *
   *
   * <pre>
   * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * The task name.
   * The task name must have the following format:
   * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
   * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
   *    hyphens (-), colons (:), or periods (.).
   *    For more information, see
   *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
   * * `LOCATION_ID` is the canonical ID for the task's location.
   *    The list of available locations can be obtained by calling
   *    [ListLocations][google.cloud.location.Locations.ListLocations].
   *    For more information, see https://cloud.google.com/about/locations/.
   * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
   *   hyphens (-). The maximum length is 100 characters.
   * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
   *   hyphens (-), or underscores (_). The maximum length is 500 characters.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public java.lang.String getName() {
    java.lang.Object ref = name_;
    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();
      name_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
   * The task name.
   * The task name must have the following format:
   * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
   * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
   *    hyphens (-), colons (:), or periods (.).
   *    For more information, see
   *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
   * * `LOCATION_ID` is the canonical ID for the task's location.
   *    The list of available locations can be obtained by calling
   *    [ListLocations][google.cloud.location.Locations.ListLocations].
   *    For more information, see https://cloud.google.com/about/locations/.
   * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
   *   hyphens (-). The maximum length is 100 characters.
   * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
   *   hyphens (-), or underscores (_). The maximum length is 500 characters.
   * </pre>
   *
   * <code>string name = 1;</code>
   */
  public com.google.protobuf.ByteString getNameBytes() {
    java.lang.Object ref = name_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      name_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int APP_ENGINE_HTTP_REQUEST_FIELD_NUMBER = 3;
  /**
   *
   *
   * <pre>
   * App Engine HTTP request that is sent to the task's target. Can
   * be set only if
   * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
   * on the queue.
   * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
   */
  public boolean hasAppEngineHttpRequest() {
    return payloadTypeCase_ == 3;
  }
  /**
   *
   *
   * <pre>
   * App Engine HTTP request that is sent to the task's target. Can
   * be set only if
   * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
   * on the queue.
   * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
   */
  public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest getAppEngineHttpRequest() {
    if (payloadTypeCase_ == 3) {
      return (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_;
    }
    return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * App Engine HTTP request that is sent to the task's target. Can
   * be set only if
   * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
   * on the queue.
   * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
   */
  public com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder
      getAppEngineHttpRequestOrBuilder() {
    if (payloadTypeCase_ == 3) {
      return (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_;
    }
    return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
  }

  public static final int PULL_MESSAGE_FIELD_NUMBER = 4;
  /**
   *
   *
   * <pre>
   * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
   * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
   * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
   */
  public boolean hasPullMessage() {
    return payloadTypeCase_ == 4;
  }
  /**
   *
   *
   * <pre>
   * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
   * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
   * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
   */
  public com.google.cloud.tasks.v2beta2.PullMessage getPullMessage() {
    if (payloadTypeCase_ == 4) {
      return (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_;
    }
    return com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
   * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
   * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
   */
  public com.google.cloud.tasks.v2beta2.PullMessageOrBuilder getPullMessageOrBuilder() {
    if (payloadTypeCase_ == 4) {
      return (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_;
    }
    return com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
  }

  public static final int SCHEDULE_TIME_FIELD_NUMBER = 5;
  private com.google.protobuf.Timestamp scheduleTime_;
  /**
   *
   *
   * <pre>
   * The time when the task is scheduled to be attempted.
   * For App Engine queues, this is when the task will be attempted or retried.
   * For pull queues, this is the time when the task is available to
   * be leased; if a task is currently leased, this is the time when
   * the current lease expires, that is, the time that the task was
   * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
   * `schedule_time` will be truncated to the nearest microsecond.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
   */
  public boolean hasScheduleTime() {
    return scheduleTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * The time when the task is scheduled to be attempted.
   * For App Engine queues, this is when the task will be attempted or retried.
   * For pull queues, this is the time when the task is available to
   * be leased; if a task is currently leased, this is the time when
   * the current lease expires, that is, the time that the task was
   * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
   * `schedule_time` will be truncated to the nearest microsecond.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
   */
  public com.google.protobuf.Timestamp getScheduleTime() {
    return scheduleTime_ == null
        ? com.google.protobuf.Timestamp.getDefaultInstance()
        : scheduleTime_;
  }
  /**
   *
   *
   * <pre>
   * The time when the task is scheduled to be attempted.
   * For App Engine queues, this is when the task will be attempted or retried.
   * For pull queues, this is the time when the task is available to
   * be leased; if a task is currently leased, this is the time when
   * the current lease expires, that is, the time that the task was
   * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
   * `schedule_time` will be truncated to the nearest microsecond.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getScheduleTimeOrBuilder() {
    return getScheduleTime();
  }

  public static final int CREATE_TIME_FIELD_NUMBER = 6;
  private com.google.protobuf.Timestamp createTime_;
  /**
   *
   *
   * <pre>
   * Output only. The time that the task was created.
   * `create_time` will be truncated to the nearest second.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 6;</code>
   */
  public boolean hasCreateTime() {
    return createTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time that the task was created.
   * `create_time` will be truncated to the nearest second.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 6;</code>
   */
  public com.google.protobuf.Timestamp getCreateTime() {
    return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time that the task was created.
   * `create_time` will be truncated to the nearest second.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp create_time = 6;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() {
    return getCreateTime();
  }

  public static final int STATUS_FIELD_NUMBER = 7;
  private com.google.cloud.tasks.v2beta2.TaskStatus status_;
  /**
   *
   *
   * <pre>
   * Output only. The task status.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
   */
  public boolean hasStatus() {
    return status_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The task status.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
   */
  public com.google.cloud.tasks.v2beta2.TaskStatus getStatus() {
    return status_ == null
        ? com.google.cloud.tasks.v2beta2.TaskStatus.getDefaultInstance()
        : status_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The task status.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
   */
  public com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder getStatusOrBuilder() {
    return getStatus();
  }

  public static final int VIEW_FIELD_NUMBER = 8;
  private int view_;
  /**
   *
   *
   * <pre>
   * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
   * been returned.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
   */
  public int getViewValue() {
    return view_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
   * been returned.
   * </pre>
   *
   * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
   */
  public com.google.cloud.tasks.v2beta2.Task.View getView() {
    @SuppressWarnings("deprecation")
    com.google.cloud.tasks.v2beta2.Task.View result =
        com.google.cloud.tasks.v2beta2.Task.View.valueOf(view_);
    return result == null ? com.google.cloud.tasks.v2beta2.Task.View.UNRECOGNIZED : result;
  }

  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 (!getNameBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_);
    }
    if (payloadTypeCase_ == 3) {
      output.writeMessage(3, (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_);
    }
    if (payloadTypeCase_ == 4) {
      output.writeMessage(4, (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_);
    }
    if (scheduleTime_ != null) {
      output.writeMessage(5, getScheduleTime());
    }
    if (createTime_ != null) {
      output.writeMessage(6, getCreateTime());
    }
    if (status_ != null) {
      output.writeMessage(7, getStatus());
    }
    if (view_ != com.google.cloud.tasks.v2beta2.Task.View.VIEW_UNSPECIFIED.getNumber()) {
      output.writeEnum(8, view_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (!getNameBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_);
    }
    if (payloadTypeCase_ == 3) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              3, (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_);
    }
    if (payloadTypeCase_ == 4) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              4, (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_);
    }
    if (scheduleTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getScheduleTime());
    }
    if (createTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getCreateTime());
    }
    if (status_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getStatus());
    }
    if (view_ != com.google.cloud.tasks.v2beta2.Task.View.VIEW_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(8, view_);
    }
    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.cloud.tasks.v2beta2.Task)) {
      return super.equals(obj);
    }
    com.google.cloud.tasks.v2beta2.Task other = (com.google.cloud.tasks.v2beta2.Task) obj;

    boolean result = true;
    result = result && getName().equals(other.getName());
    result = result && (hasScheduleTime() == other.hasScheduleTime());
    if (hasScheduleTime()) {
      result = result && getScheduleTime().equals(other.getScheduleTime());
    }
    result = result && (hasCreateTime() == other.hasCreateTime());
    if (hasCreateTime()) {
      result = result && getCreateTime().equals(other.getCreateTime());
    }
    result = result && (hasStatus() == other.hasStatus());
    if (hasStatus()) {
      result = result && getStatus().equals(other.getStatus());
    }
    result = result && view_ == other.view_;
    result = result && getPayloadTypeCase().equals(other.getPayloadTypeCase());
    if (!result) return false;
    switch (payloadTypeCase_) {
      case 3:
        result = result && getAppEngineHttpRequest().equals(other.getAppEngineHttpRequest());
        break;
      case 4:
        result = result && getPullMessage().equals(other.getPullMessage());
        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) + NAME_FIELD_NUMBER;
    hash = (53 * hash) + getName().hashCode();
    if (hasScheduleTime()) {
      hash = (37 * hash) + SCHEDULE_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getScheduleTime().hashCode();
    }
    if (hasCreateTime()) {
      hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getCreateTime().hashCode();
    }
    if (hasStatus()) {
      hash = (37 * hash) + STATUS_FIELD_NUMBER;
      hash = (53 * hash) + getStatus().hashCode();
    }
    hash = (37 * hash) + VIEW_FIELD_NUMBER;
    hash = (53 * hash) + view_;
    switch (payloadTypeCase_) {
      case 3:
        hash = (37 * hash) + APP_ENGINE_HTTP_REQUEST_FIELD_NUMBER;
        hash = (53 * hash) + getAppEngineHttpRequest().hashCode();
        break;
      case 4:
        hash = (37 * hash) + PULL_MESSAGE_FIELD_NUMBER;
        hash = (53 * hash) + getPullMessage().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

  public static com.google.cloud.tasks.v2beta2.Task 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.Task 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.Task 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.Task 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>
   * A unit of scheduled work.
   * </pre>
   *
   * Protobuf type {@code google.cloud.tasks.v2beta2.Task}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.tasks.v2beta2.Task)
      com.google.cloud.tasks.v2beta2.TaskOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.tasks.v2beta2.TaskProto
          .internal_static_google_cloud_tasks_v2beta2_Task_descriptor;
    }

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

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

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      name_ = "";

      if (scheduleTimeBuilder_ == null) {
        scheduleTime_ = null;
      } else {
        scheduleTime_ = null;
        scheduleTimeBuilder_ = null;
      }
      if (createTimeBuilder_ == null) {
        createTime_ = null;
      } else {
        createTime_ = null;
        createTimeBuilder_ = null;
      }
      if (statusBuilder_ == null) {
        status_ = null;
      } else {
        status_ = null;
        statusBuilder_ = null;
      }
      view_ = 0;

      payloadTypeCase_ = 0;
      payloadType_ = 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_Task_descriptor;
    }

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

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

    @java.lang.Override
    public com.google.cloud.tasks.v2beta2.Task buildPartial() {
      com.google.cloud.tasks.v2beta2.Task result = new com.google.cloud.tasks.v2beta2.Task(this);
      result.name_ = name_;
      if (payloadTypeCase_ == 3) {
        if (appEngineHttpRequestBuilder_ == null) {
          result.payloadType_ = payloadType_;
        } else {
          result.payloadType_ = appEngineHttpRequestBuilder_.build();
        }
      }
      if (payloadTypeCase_ == 4) {
        if (pullMessageBuilder_ == null) {
          result.payloadType_ = payloadType_;
        } else {
          result.payloadType_ = pullMessageBuilder_.build();
        }
      }
      if (scheduleTimeBuilder_ == null) {
        result.scheduleTime_ = scheduleTime_;
      } else {
        result.scheduleTime_ = scheduleTimeBuilder_.build();
      }
      if (createTimeBuilder_ == null) {
        result.createTime_ = createTime_;
      } else {
        result.createTime_ = createTimeBuilder_.build();
      }
      if (statusBuilder_ == null) {
        result.status_ = status_;
      } else {
        result.status_ = statusBuilder_.build();
      }
      result.view_ = view_;
      result.payloadTypeCase_ = payloadTypeCase_;
      onBuilt();
      return result;
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(com.google.cloud.tasks.v2beta2.Task other) {
      if (other == com.google.cloud.tasks.v2beta2.Task.getDefaultInstance()) return this;
      if (!other.getName().isEmpty()) {
        name_ = other.name_;
        onChanged();
      }
      if (other.hasScheduleTime()) {
        mergeScheduleTime(other.getScheduleTime());
      }
      if (other.hasCreateTime()) {
        mergeCreateTime(other.getCreateTime());
      }
      if (other.hasStatus()) {
        mergeStatus(other.getStatus());
      }
      if (other.view_ != 0) {
        setViewValue(other.getViewValue());
      }
      switch (other.getPayloadTypeCase()) {
        case APP_ENGINE_HTTP_REQUEST:
          {
            mergeAppEngineHttpRequest(other.getAppEngineHttpRequest());
            break;
          }
        case PULL_MESSAGE:
          {
            mergePullMessage(other.getPullMessage());
            break;
          }
        case PAYLOADTYPE_NOT_SET:
          {
            break;
          }
      }
      this.mergeUnknownFields(other.unknownFields);
      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 {
      com.google.cloud.tasks.v2beta2.Task parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.tasks.v2beta2.Task) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int payloadTypeCase_ = 0;
    private java.lang.Object payloadType_;

    public PayloadTypeCase getPayloadTypeCase() {
      return PayloadTypeCase.forNumber(payloadTypeCase_);
    }

    public Builder clearPayloadType() {
      payloadTypeCase_ = 0;
      payloadType_ = null;
      onChanged();
      return this;
    }

    private java.lang.Object name_ = "";
    /**
     *
     *
     * <pre>
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public java.lang.String getName() {
      java.lang.Object ref = name_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        name_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public com.google.protobuf.ByteString getNameBytes() {
      java.lang.Object ref = name_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        name_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setName(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      name_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder clearName() {

      name_ = getDefaultInstance().getName();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optionally caller-specified in [CreateTask][google.cloud.tasks.v2beta2.CloudTasks.CreateTask].
     * The task name.
     * The task name must have the following format:
     * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`
     * * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]),
     *    hyphens (-), colons (:), or periods (.).
     *    For more information, see
     *    [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
     * * `LOCATION_ID` is the canonical ID for the task's location.
     *    The list of available locations can be obtained by calling
     *    [ListLocations][google.cloud.location.Locations.ListLocations].
     *    For more information, see https://cloud.google.com/about/locations/.
     * * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or
     *   hyphens (-). The maximum length is 100 characters.
     * * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]),
     *   hyphens (-), or underscores (_). The maximum length is 500 characters.
     * </pre>
     *
     * <code>string name = 1;</code>
     */
    public Builder setNameBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

      name_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest,
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder,
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder>
        appEngineHttpRequestBuilder_;
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public boolean hasAppEngineHttpRequest() {
      return payloadTypeCase_ == 3;
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest getAppEngineHttpRequest() {
      if (appEngineHttpRequestBuilder_ == null) {
        if (payloadTypeCase_ == 3) {
          return (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_;
        }
        return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
      } else {
        if (payloadTypeCase_ == 3) {
          return appEngineHttpRequestBuilder_.getMessage();
        }
        return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public Builder setAppEngineHttpRequest(
        com.google.cloud.tasks.v2beta2.AppEngineHttpRequest value) {
      if (appEngineHttpRequestBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        payloadType_ = value;
        onChanged();
      } else {
        appEngineHttpRequestBuilder_.setMessage(value);
      }
      payloadTypeCase_ = 3;
      return this;
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public Builder setAppEngineHttpRequest(
        com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder builderForValue) {
      if (appEngineHttpRequestBuilder_ == null) {
        payloadType_ = builderForValue.build();
        onChanged();
      } else {
        appEngineHttpRequestBuilder_.setMessage(builderForValue.build());
      }
      payloadTypeCase_ = 3;
      return this;
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public Builder mergeAppEngineHttpRequest(
        com.google.cloud.tasks.v2beta2.AppEngineHttpRequest value) {
      if (appEngineHttpRequestBuilder_ == null) {
        if (payloadTypeCase_ == 3
            && payloadType_
                != com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance()) {
          payloadType_ =
              com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.newBuilder(
                      (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          payloadType_ = value;
        }
        onChanged();
      } else {
        if (payloadTypeCase_ == 3) {
          appEngineHttpRequestBuilder_.mergeFrom(value);
        }
        appEngineHttpRequestBuilder_.setMessage(value);
      }
      payloadTypeCase_ = 3;
      return this;
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public Builder clearAppEngineHttpRequest() {
      if (appEngineHttpRequestBuilder_ == null) {
        if (payloadTypeCase_ == 3) {
          payloadTypeCase_ = 0;
          payloadType_ = null;
          onChanged();
        }
      } else {
        if (payloadTypeCase_ == 3) {
          payloadTypeCase_ = 0;
          payloadType_ = null;
        }
        appEngineHttpRequestBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder
        getAppEngineHttpRequestBuilder() {
      return getAppEngineHttpRequestFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    public com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder
        getAppEngineHttpRequestOrBuilder() {
      if ((payloadTypeCase_ == 3) && (appEngineHttpRequestBuilder_ != null)) {
        return appEngineHttpRequestBuilder_.getMessageOrBuilder();
      } else {
        if (payloadTypeCase_ == 3) {
          return (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_;
        }
        return com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * App Engine HTTP request that is sent to the task's target. Can
     * be set only if
     * [app_engine_http_target][google.cloud.tasks.v2beta2.Queue.app_engine_http_target] is set
     * on the queue.
     * An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2beta2.AppEngineHttpRequest] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.AppEngineHttpRequest app_engine_http_request = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest,
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder,
            com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder>
        getAppEngineHttpRequestFieldBuilder() {
      if (appEngineHttpRequestBuilder_ == null) {
        if (!(payloadTypeCase_ == 3)) {
          payloadType_ = com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.getDefaultInstance();
        }
        appEngineHttpRequestBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.AppEngineHttpRequest,
                com.google.cloud.tasks.v2beta2.AppEngineHttpRequest.Builder,
                com.google.cloud.tasks.v2beta2.AppEngineHttpRequestOrBuilder>(
                (com.google.cloud.tasks.v2beta2.AppEngineHttpRequest) payloadType_,
                getParentForChildren(),
                isClean());
        payloadType_ = null;
      }
      payloadTypeCase_ = 3;
      onChanged();
      ;
      return appEngineHttpRequestBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.PullMessage,
            com.google.cloud.tasks.v2beta2.PullMessage.Builder,
            com.google.cloud.tasks.v2beta2.PullMessageOrBuilder>
        pullMessageBuilder_;
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public boolean hasPullMessage() {
      return payloadTypeCase_ == 4;
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public com.google.cloud.tasks.v2beta2.PullMessage getPullMessage() {
      if (pullMessageBuilder_ == null) {
        if (payloadTypeCase_ == 4) {
          return (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_;
        }
        return com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
      } else {
        if (payloadTypeCase_ == 4) {
          return pullMessageBuilder_.getMessage();
        }
        return com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public Builder setPullMessage(com.google.cloud.tasks.v2beta2.PullMessage value) {
      if (pullMessageBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        payloadType_ = value;
        onChanged();
      } else {
        pullMessageBuilder_.setMessage(value);
      }
      payloadTypeCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public Builder setPullMessage(
        com.google.cloud.tasks.v2beta2.PullMessage.Builder builderForValue) {
      if (pullMessageBuilder_ == null) {
        payloadType_ = builderForValue.build();
        onChanged();
      } else {
        pullMessageBuilder_.setMessage(builderForValue.build());
      }
      payloadTypeCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public Builder mergePullMessage(com.google.cloud.tasks.v2beta2.PullMessage value) {
      if (pullMessageBuilder_ == null) {
        if (payloadTypeCase_ == 4
            && payloadType_ != com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance()) {
          payloadType_ =
              com.google.cloud.tasks.v2beta2.PullMessage.newBuilder(
                      (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          payloadType_ = value;
        }
        onChanged();
      } else {
        if (payloadTypeCase_ == 4) {
          pullMessageBuilder_.mergeFrom(value);
        }
        pullMessageBuilder_.setMessage(value);
      }
      payloadTypeCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public Builder clearPullMessage() {
      if (pullMessageBuilder_ == null) {
        if (payloadTypeCase_ == 4) {
          payloadTypeCase_ = 0;
          payloadType_ = null;
          onChanged();
        }
      } else {
        if (payloadTypeCase_ == 4) {
          payloadTypeCase_ = 0;
          payloadType_ = null;
        }
        pullMessageBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public com.google.cloud.tasks.v2beta2.PullMessage.Builder getPullMessageBuilder() {
      return getPullMessageFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    public com.google.cloud.tasks.v2beta2.PullMessageOrBuilder getPullMessageOrBuilder() {
      if ((payloadTypeCase_ == 4) && (pullMessageBuilder_ != null)) {
        return pullMessageBuilder_.getMessageOrBuilder();
      } else {
        if (payloadTypeCase_ == 4) {
          return (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_;
        }
        return com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * [LeaseTasks][google.cloud.tasks.v2beta2.CloudTasks.LeaseTasks] to process the task. Can be
     * set only if [pull_target][google.cloud.tasks.v2beta2.Queue.pull_target] is set on the queue.
     * A pull task is a task that has [PullMessage][google.cloud.tasks.v2beta2.PullMessage] set.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.PullMessage pull_message = 4;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.PullMessage,
            com.google.cloud.tasks.v2beta2.PullMessage.Builder,
            com.google.cloud.tasks.v2beta2.PullMessageOrBuilder>
        getPullMessageFieldBuilder() {
      if (pullMessageBuilder_ == null) {
        if (!(payloadTypeCase_ == 4)) {
          payloadType_ = com.google.cloud.tasks.v2beta2.PullMessage.getDefaultInstance();
        }
        pullMessageBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.PullMessage,
                com.google.cloud.tasks.v2beta2.PullMessage.Builder,
                com.google.cloud.tasks.v2beta2.PullMessageOrBuilder>(
                (com.google.cloud.tasks.v2beta2.PullMessage) payloadType_,
                getParentForChildren(),
                isClean());
        payloadType_ = null;
      }
      payloadTypeCase_ = 4;
      onChanged();
      ;
      return pullMessageBuilder_;
    }

    private com.google.protobuf.Timestamp scheduleTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        scheduleTimeBuilder_;
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public boolean hasScheduleTime() {
      return scheduleTimeBuilder_ != null || scheduleTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public com.google.protobuf.Timestamp getScheduleTime() {
      if (scheduleTimeBuilder_ == null) {
        return scheduleTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : scheduleTime_;
      } else {
        return scheduleTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public Builder setScheduleTime(com.google.protobuf.Timestamp value) {
      if (scheduleTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        scheduleTime_ = value;
        onChanged();
      } else {
        scheduleTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public Builder setScheduleTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (scheduleTimeBuilder_ == null) {
        scheduleTime_ = builderForValue.build();
        onChanged();
      } else {
        scheduleTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public Builder mergeScheduleTime(com.google.protobuf.Timestamp value) {
      if (scheduleTimeBuilder_ == null) {
        if (scheduleTime_ != null) {
          scheduleTime_ =
              com.google.protobuf.Timestamp.newBuilder(scheduleTime_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          scheduleTime_ = value;
        }
        onChanged();
      } else {
        scheduleTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public Builder clearScheduleTime() {
      if (scheduleTimeBuilder_ == null) {
        scheduleTime_ = null;
        onChanged();
      } else {
        scheduleTime_ = null;
        scheduleTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public com.google.protobuf.Timestamp.Builder getScheduleTimeBuilder() {

      onChanged();
      return getScheduleTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getScheduleTimeOrBuilder() {
      if (scheduleTimeBuilder_ != null) {
        return scheduleTimeBuilder_.getMessageOrBuilder();
      } else {
        return scheduleTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : scheduleTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * The time when the task is scheduled to be attempted.
     * For App Engine queues, this is when the task will be attempted or retried.
     * For pull queues, this is the time when the task is available to
     * be leased; if a task is currently leased, this is the time when
     * the current lease expires, that is, the time that the task was
     * leased plus the [lease_duration][google.cloud.tasks.v2beta2.LeaseTasksRequest.lease_duration].
     * `schedule_time` will be truncated to the nearest microsecond.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp schedule_time = 5;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getScheduleTimeFieldBuilder() {
      if (scheduleTimeBuilder_ == null) {
        scheduleTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getScheduleTime(), getParentForChildren(), isClean());
        scheduleTime_ = null;
      }
      return scheduleTimeBuilder_;
    }

    private com.google.protobuf.Timestamp createTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        createTimeBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public boolean hasCreateTime() {
      return createTimeBuilder_ != null || createTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public com.google.protobuf.Timestamp getCreateTime() {
      if (createTimeBuilder_ == null) {
        return createTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : createTime_;
      } else {
        return createTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public Builder setCreateTime(com.google.protobuf.Timestamp value) {
      if (createTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        createTime_ = value;
        onChanged();
      } else {
        createTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (createTimeBuilder_ == null) {
        createTime_ = builderForValue.build();
        onChanged();
      } else {
        createTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public Builder mergeCreateTime(com.google.protobuf.Timestamp value) {
      if (createTimeBuilder_ == null) {
        if (createTime_ != null) {
          createTime_ =
              com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial();
        } else {
          createTime_ = value;
        }
        onChanged();
      } else {
        createTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public Builder clearCreateTime() {
      if (createTimeBuilder_ == null) {
        createTime_ = null;
        onChanged();
      } else {
        createTime_ = null;
        createTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() {

      onChanged();
      return getCreateTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() {
      if (createTimeBuilder_ != null) {
        return createTimeBuilder_.getMessageOrBuilder();
      } else {
        return createTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : createTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time that the task was created.
     * `create_time` will be truncated to the nearest second.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp create_time = 6;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getCreateTimeFieldBuilder() {
      if (createTimeBuilder_ == null) {
        createTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getCreateTime(), getParentForChildren(), isClean());
        createTime_ = null;
      }
      return createTimeBuilder_;
    }

    private com.google.cloud.tasks.v2beta2.TaskStatus status_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.TaskStatus,
            com.google.cloud.tasks.v2beta2.TaskStatus.Builder,
            com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder>
        statusBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public boolean hasStatus() {
      return statusBuilder_ != null || status_ != null;
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public com.google.cloud.tasks.v2beta2.TaskStatus getStatus() {
      if (statusBuilder_ == null) {
        return status_ == null
            ? com.google.cloud.tasks.v2beta2.TaskStatus.getDefaultInstance()
            : status_;
      } else {
        return statusBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public Builder setStatus(com.google.cloud.tasks.v2beta2.TaskStatus value) {
      if (statusBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        status_ = value;
        onChanged();
      } else {
        statusBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public Builder setStatus(com.google.cloud.tasks.v2beta2.TaskStatus.Builder builderForValue) {
      if (statusBuilder_ == null) {
        status_ = builderForValue.build();
        onChanged();
      } else {
        statusBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public Builder mergeStatus(com.google.cloud.tasks.v2beta2.TaskStatus value) {
      if (statusBuilder_ == null) {
        if (status_ != null) {
          status_ =
              com.google.cloud.tasks.v2beta2.TaskStatus.newBuilder(status_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          status_ = value;
        }
        onChanged();
      } else {
        statusBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public Builder clearStatus() {
      if (statusBuilder_ == null) {
        status_ = null;
        onChanged();
      } else {
        status_ = null;
        statusBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public com.google.cloud.tasks.v2beta2.TaskStatus.Builder getStatusBuilder() {

      onChanged();
      return getStatusFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    public com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder getStatusOrBuilder() {
      if (statusBuilder_ != null) {
        return statusBuilder_.getMessageOrBuilder();
      } else {
        return status_ == null
            ? com.google.cloud.tasks.v2beta2.TaskStatus.getDefaultInstance()
            : status_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The task status.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.TaskStatus status = 7;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.tasks.v2beta2.TaskStatus,
            com.google.cloud.tasks.v2beta2.TaskStatus.Builder,
            com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder>
        getStatusFieldBuilder() {
      if (statusBuilder_ == null) {
        statusBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.tasks.v2beta2.TaskStatus,
                com.google.cloud.tasks.v2beta2.TaskStatus.Builder,
                com.google.cloud.tasks.v2beta2.TaskStatusOrBuilder>(
                getStatus(), getParentForChildren(), isClean());
        status_ = null;
      }
      return statusBuilder_;
    }

    private int view_ = 0;
    /**
     *
     *
     * <pre>
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
     * been returned.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
     */
    public int getViewValue() {
      return view_;
    }
    /**
     *
     *
     * <pre>
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
     * been returned.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
     */
    public Builder setViewValue(int value) {
      view_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
     * been returned.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
     */
    public com.google.cloud.tasks.v2beta2.Task.View getView() {
      @SuppressWarnings("deprecation")
      com.google.cloud.tasks.v2beta2.Task.View result =
          com.google.cloud.tasks.v2beta2.Task.View.valueOf(view_);
      return result == null ? com.google.cloud.tasks.v2beta2.Task.View.UNRECOGNIZED : result;
    }
    /**
     *
     *
     * <pre>
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
     * been returned.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
     */
    public Builder setView(com.google.cloud.tasks.v2beta2.Task.View value) {
      if (value == null) {
        throw new NullPointerException();
      }

      view_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2beta2.Task] has
     * been returned.
     * </pre>
     *
     * <code>.google.cloud.tasks.v2beta2.Task.View view = 8;</code>
     */
    public Builder clearView() {

      view_ = 0;
      onChanged();
      return this;
    }

    @java.lang.Override
    public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFieldsProto3(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.Task)
  }

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

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

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

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

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

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

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