// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/dataproc/v1/jobs.proto

package com.google.cloud.dataproc.v1;

/**
 *
 *
 * <pre>
 * Cloud Dataproc job status.
 * </pre>
 *
 * Protobuf type {@code google.cloud.dataproc.v1.JobStatus}
 */
public final class JobStatus extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.dataproc.v1.JobStatus)
    JobStatusOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use JobStatus.newBuilder() to construct.
  private JobStatus(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private JobStatus() {
    state_ = 0;
    details_ = "";
    substate_ = 0;
  }

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

  private JobStatus(
      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 8:
            {
              int rawValue = input.readEnum();

              state_ = rawValue;
              break;
            }
          case 18:
            {
              java.lang.String s = input.readStringRequireUtf8();

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

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

              substate_ = 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.dataproc.v1.JobsProto
        .internal_static_google_cloud_dataproc_v1_JobStatus_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.dataproc.v1.JobsProto
        .internal_static_google_cloud_dataproc_v1_JobStatus_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.dataproc.v1.JobStatus.class,
            com.google.cloud.dataproc.v1.JobStatus.Builder.class);
  }

  /**
   *
   *
   * <pre>
   * The job state.
   * </pre>
   *
   * Protobuf enum {@code google.cloud.dataproc.v1.JobStatus.State}
   */
  public enum State implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * The job state is unknown.
     * </pre>
     *
     * <code>STATE_UNSPECIFIED = 0;</code>
     */
    STATE_UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * The job is pending; it has been submitted, but is not yet running.
     * </pre>
     *
     * <code>PENDING = 1;</code>
     */
    PENDING(1),
    /**
     *
     *
     * <pre>
     * Job has been received by the service and completed initial setup;
     * it will soon be submitted to the cluster.
     * </pre>
     *
     * <code>SETUP_DONE = 8;</code>
     */
    SETUP_DONE(8),
    /**
     *
     *
     * <pre>
     * The job is running on the cluster.
     * </pre>
     *
     * <code>RUNNING = 2;</code>
     */
    RUNNING(2),
    /**
     *
     *
     * <pre>
     * A CancelJob request has been received, but is pending.
     * </pre>
     *
     * <code>CANCEL_PENDING = 3;</code>
     */
    CANCEL_PENDING(3),
    /**
     *
     *
     * <pre>
     * Transient in-flight resources have been canceled, and the request to
     * cancel the running job has been issued to the cluster.
     * </pre>
     *
     * <code>CANCEL_STARTED = 7;</code>
     */
    CANCEL_STARTED(7),
    /**
     *
     *
     * <pre>
     * The job cancellation was successful.
     * </pre>
     *
     * <code>CANCELLED = 4;</code>
     */
    CANCELLED(4),
    /**
     *
     *
     * <pre>
     * The job has completed successfully.
     * </pre>
     *
     * <code>DONE = 5;</code>
     */
    DONE(5),
    /**
     *
     *
     * <pre>
     * The job has completed, but encountered an error.
     * </pre>
     *
     * <code>ERROR = 6;</code>
     */
    ERROR(6),
    /**
     *
     *
     * <pre>
     * Job attempt has failed. The detail field contains failure details for
     * this attempt.
     * Applies to restartable jobs only.
     * </pre>
     *
     * <code>ATTEMPT_FAILURE = 9;</code>
     */
    ATTEMPT_FAILURE(9),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * The job state is unknown.
     * </pre>
     *
     * <code>STATE_UNSPECIFIED = 0;</code>
     */
    public static final int STATE_UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * The job is pending; it has been submitted, but is not yet running.
     * </pre>
     *
     * <code>PENDING = 1;</code>
     */
    public static final int PENDING_VALUE = 1;
    /**
     *
     *
     * <pre>
     * Job has been received by the service and completed initial setup;
     * it will soon be submitted to the cluster.
     * </pre>
     *
     * <code>SETUP_DONE = 8;</code>
     */
    public static final int SETUP_DONE_VALUE = 8;
    /**
     *
     *
     * <pre>
     * The job is running on the cluster.
     * </pre>
     *
     * <code>RUNNING = 2;</code>
     */
    public static final int RUNNING_VALUE = 2;
    /**
     *
     *
     * <pre>
     * A CancelJob request has been received, but is pending.
     * </pre>
     *
     * <code>CANCEL_PENDING = 3;</code>
     */
    public static final int CANCEL_PENDING_VALUE = 3;
    /**
     *
     *
     * <pre>
     * Transient in-flight resources have been canceled, and the request to
     * cancel the running job has been issued to the cluster.
     * </pre>
     *
     * <code>CANCEL_STARTED = 7;</code>
     */
    public static final int CANCEL_STARTED_VALUE = 7;
    /**
     *
     *
     * <pre>
     * The job cancellation was successful.
     * </pre>
     *
     * <code>CANCELLED = 4;</code>
     */
    public static final int CANCELLED_VALUE = 4;
    /**
     *
     *
     * <pre>
     * The job has completed successfully.
     * </pre>
     *
     * <code>DONE = 5;</code>
     */
    public static final int DONE_VALUE = 5;
    /**
     *
     *
     * <pre>
     * The job has completed, but encountered an error.
     * </pre>
     *
     * <code>ERROR = 6;</code>
     */
    public static final int ERROR_VALUE = 6;
    /**
     *
     *
     * <pre>
     * Job attempt has failed. The detail field contains failure details for
     * this attempt.
     * Applies to restartable jobs only.
     * </pre>
     *
     * <code>ATTEMPT_FAILURE = 9;</code>
     */
    public static final int ATTEMPT_FAILURE_VALUE = 9;

    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 State valueOf(int value) {
      return forNumber(value);
    }

    public static State forNumber(int value) {
      switch (value) {
        case 0:
          return STATE_UNSPECIFIED;
        case 1:
          return PENDING;
        case 8:
          return SETUP_DONE;
        case 2:
          return RUNNING;
        case 3:
          return CANCEL_PENDING;
        case 7:
          return CANCEL_STARTED;
        case 4:
          return CANCELLED;
        case 5:
          return DONE;
        case 6:
          return ERROR;
        case 9:
          return ATTEMPT_FAILURE;
        default:
          return null;
      }
    }

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

    private static final com.google.protobuf.Internal.EnumLiteMap<State> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<State>() {
          public State findValueByNumber(int number) {
            return State.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.dataproc.v1.JobStatus.getDescriptor().getEnumTypes().get(0);
    }

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

    public static State 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 State(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.cloud.dataproc.v1.JobStatus.State)
  }

  /**
   *
   *
   * <pre>
   * The job substate.
   * </pre>
   *
   * Protobuf enum {@code google.cloud.dataproc.v1.JobStatus.Substate}
   */
  public enum Substate implements com.google.protobuf.ProtocolMessageEnum {
    /**
     *
     *
     * <pre>
     * The job substate is unknown.
     * </pre>
     *
     * <code>UNSPECIFIED = 0;</code>
     */
    UNSPECIFIED(0),
    /**
     *
     *
     * <pre>
     * The Job is submitted to the agent.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>SUBMITTED = 1;</code>
     */
    SUBMITTED(1),
    /**
     *
     *
     * <pre>
     * The Job has been received and is awaiting execution (it may be waiting
     * for a condition to be met). See the "details" field for the reason for
     * the delay.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>QUEUED = 2;</code>
     */
    QUEUED(2),
    /**
     *
     *
     * <pre>
     * The agent-reported status is out of date, which may be caused by a
     * loss of communication between the agent and Cloud Dataproc. If the
     * agent does not send a timely update, the job will fail.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>STALE_STATUS = 3;</code>
     */
    STALE_STATUS(3),
    UNRECOGNIZED(-1),
    ;

    /**
     *
     *
     * <pre>
     * The job substate is unknown.
     * </pre>
     *
     * <code>UNSPECIFIED = 0;</code>
     */
    public static final int UNSPECIFIED_VALUE = 0;
    /**
     *
     *
     * <pre>
     * The Job is submitted to the agent.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>SUBMITTED = 1;</code>
     */
    public static final int SUBMITTED_VALUE = 1;
    /**
     *
     *
     * <pre>
     * The Job has been received and is awaiting execution (it may be waiting
     * for a condition to be met). See the "details" field for the reason for
     * the delay.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>QUEUED = 2;</code>
     */
    public static final int QUEUED_VALUE = 2;
    /**
     *
     *
     * <pre>
     * The agent-reported status is out of date, which may be caused by a
     * loss of communication between the agent and Cloud Dataproc. If the
     * agent does not send a timely update, the job will fail.
     * Applies to RUNNING state.
     * </pre>
     *
     * <code>STALE_STATUS = 3;</code>
     */
    public static final int STALE_STATUS_VALUE = 3;

    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 Substate valueOf(int value) {
      return forNumber(value);
    }

    public static Substate forNumber(int value) {
      switch (value) {
        case 0:
          return UNSPECIFIED;
        case 1:
          return SUBMITTED;
        case 2:
          return QUEUED;
        case 3:
          return STALE_STATUS;
        default:
          return null;
      }
    }

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

    private static final com.google.protobuf.Internal.EnumLiteMap<Substate> internalValueMap =
        new com.google.protobuf.Internal.EnumLiteMap<Substate>() {
          public Substate findValueByNumber(int number) {
            return Substate.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.dataproc.v1.JobStatus.getDescriptor().getEnumTypes().get(1);
    }

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

    public static Substate 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 Substate(int value) {
      this.value = value;
    }

    // @@protoc_insertion_point(enum_scope:google.cloud.dataproc.v1.JobStatus.Substate)
  }

  public static final int STATE_FIELD_NUMBER = 1;
  private int state_;
  /**
   *
   *
   * <pre>
   * Output only. A state message specifying the overall job state.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
   */
  public int getStateValue() {
    return state_;
  }
  /**
   *
   *
   * <pre>
   * Output only. A state message specifying the overall job state.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
   */
  public com.google.cloud.dataproc.v1.JobStatus.State getState() {
    @SuppressWarnings("deprecation")
    com.google.cloud.dataproc.v1.JobStatus.State result =
        com.google.cloud.dataproc.v1.JobStatus.State.valueOf(state_);
    return result == null ? com.google.cloud.dataproc.v1.JobStatus.State.UNRECOGNIZED : result;
  }

  public static final int DETAILS_FIELD_NUMBER = 2;
  private volatile java.lang.Object details_;
  /**
   *
   *
   * <pre>
   * Output only. Optional job state details, such as an error
   * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
   * </pre>
   *
   * <code>string details = 2;</code>
   */
  public java.lang.String getDetails() {
    java.lang.Object ref = details_;
    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();
      details_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * Output only. Optional job state details, such as an error
   * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
   * </pre>
   *
   * <code>string details = 2;</code>
   */
  public com.google.protobuf.ByteString getDetailsBytes() {
    java.lang.Object ref = details_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      details_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int STATE_START_TIME_FIELD_NUMBER = 6;
  private com.google.protobuf.Timestamp stateStartTime_;
  /**
   *
   *
   * <pre>
   * Output only. The time when this state was entered.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
   */
  public boolean hasStateStartTime() {
    return stateStartTime_ != null;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time when this state was entered.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
   */
  public com.google.protobuf.Timestamp getStateStartTime() {
    return stateStartTime_ == null
        ? com.google.protobuf.Timestamp.getDefaultInstance()
        : stateStartTime_;
  }
  /**
   *
   *
   * <pre>
   * Output only. The time when this state was entered.
   * </pre>
   *
   * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
   */
  public com.google.protobuf.TimestampOrBuilder getStateStartTimeOrBuilder() {
    return getStateStartTime();
  }

  public static final int SUBSTATE_FIELD_NUMBER = 7;
  private int substate_;
  /**
   *
   *
   * <pre>
   * Output only. Additional state information, which includes
   * status reported by the agent.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
   */
  public int getSubstateValue() {
    return substate_;
  }
  /**
   *
   *
   * <pre>
   * Output only. Additional state information, which includes
   * status reported by the agent.
   * </pre>
   *
   * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
   */
  public com.google.cloud.dataproc.v1.JobStatus.Substate getSubstate() {
    @SuppressWarnings("deprecation")
    com.google.cloud.dataproc.v1.JobStatus.Substate result =
        com.google.cloud.dataproc.v1.JobStatus.Substate.valueOf(substate_);
    return result == null ? com.google.cloud.dataproc.v1.JobStatus.Substate.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 (state_ != com.google.cloud.dataproc.v1.JobStatus.State.STATE_UNSPECIFIED.getNumber()) {
      output.writeEnum(1, state_);
    }
    if (!getDetailsBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, details_);
    }
    if (stateStartTime_ != null) {
      output.writeMessage(6, getStateStartTime());
    }
    if (substate_ != com.google.cloud.dataproc.v1.JobStatus.Substate.UNSPECIFIED.getNumber()) {
      output.writeEnum(7, substate_);
    }
    unknownFields.writeTo(output);
  }

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

    size = 0;
    if (state_ != com.google.cloud.dataproc.v1.JobStatus.State.STATE_UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_);
    }
    if (!getDetailsBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, details_);
    }
    if (stateStartTime_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getStateStartTime());
    }
    if (substate_ != com.google.cloud.dataproc.v1.JobStatus.Substate.UNSPECIFIED.getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(7, substate_);
    }
    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.dataproc.v1.JobStatus)) {
      return super.equals(obj);
    }
    com.google.cloud.dataproc.v1.JobStatus other = (com.google.cloud.dataproc.v1.JobStatus) obj;

    boolean result = true;
    result = result && state_ == other.state_;
    result = result && getDetails().equals(other.getDetails());
    result = result && (hasStateStartTime() == other.hasStateStartTime());
    if (hasStateStartTime()) {
      result = result && getStateStartTime().equals(other.getStateStartTime());
    }
    result = result && substate_ == other.substate_;
    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) + STATE_FIELD_NUMBER;
    hash = (53 * hash) + state_;
    hash = (37 * hash) + DETAILS_FIELD_NUMBER;
    hash = (53 * hash) + getDetails().hashCode();
    if (hasStateStartTime()) {
      hash = (37 * hash) + STATE_START_TIME_FIELD_NUMBER;
      hash = (53 * hash) + getStateStartTime().hashCode();
    }
    hash = (37 * hash) + SUBSTATE_FIELD_NUMBER;
    hash = (53 * hash) + substate_;
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

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

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

  public static com.google.cloud.dataproc.v1.JobStatus 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.dataproc.v1.JobStatus 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>
   * Cloud Dataproc job status.
   * </pre>
   *
   * Protobuf type {@code google.cloud.dataproc.v1.JobStatus}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.dataproc.v1.JobStatus)
      com.google.cloud.dataproc.v1.JobStatusOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.dataproc.v1.JobsProto
          .internal_static_google_cloud_dataproc_v1_JobStatus_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.dataproc.v1.JobsProto
          .internal_static_google_cloud_dataproc_v1_JobStatus_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.dataproc.v1.JobStatus.class,
              com.google.cloud.dataproc.v1.JobStatus.Builder.class);
    }

    // Construct using com.google.cloud.dataproc.v1.JobStatus.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();
      state_ = 0;

      details_ = "";

      if (stateStartTimeBuilder_ == null) {
        stateStartTime_ = null;
      } else {
        stateStartTime_ = null;
        stateStartTimeBuilder_ = null;
      }
      substate_ = 0;

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.dataproc.v1.JobsProto
          .internal_static_google_cloud_dataproc_v1_JobStatus_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.dataproc.v1.JobStatus getDefaultInstanceForType() {
      return com.google.cloud.dataproc.v1.JobStatus.getDefaultInstance();
    }

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

    @java.lang.Override
    public com.google.cloud.dataproc.v1.JobStatus buildPartial() {
      com.google.cloud.dataproc.v1.JobStatus result =
          new com.google.cloud.dataproc.v1.JobStatus(this);
      result.state_ = state_;
      result.details_ = details_;
      if (stateStartTimeBuilder_ == null) {
        result.stateStartTime_ = stateStartTime_;
      } else {
        result.stateStartTime_ = stateStartTimeBuilder_.build();
      }
      result.substate_ = substate_;
      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.dataproc.v1.JobStatus) {
        return mergeFrom((com.google.cloud.dataproc.v1.JobStatus) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.dataproc.v1.JobStatus other) {
      if (other == com.google.cloud.dataproc.v1.JobStatus.getDefaultInstance()) return this;
      if (other.state_ != 0) {
        setStateValue(other.getStateValue());
      }
      if (!other.getDetails().isEmpty()) {
        details_ = other.details_;
        onChanged();
      }
      if (other.hasStateStartTime()) {
        mergeStateStartTime(other.getStateStartTime());
      }
      if (other.substate_ != 0) {
        setSubstateValue(other.getSubstateValue());
      }
      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.dataproc.v1.JobStatus parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.google.cloud.dataproc.v1.JobStatus) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }

    private int state_ = 0;
    /**
     *
     *
     * <pre>
     * Output only. A state message specifying the overall job state.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
     */
    public int getStateValue() {
      return state_;
    }
    /**
     *
     *
     * <pre>
     * Output only. A state message specifying the overall job state.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
     */
    public Builder setStateValue(int value) {
      state_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. A state message specifying the overall job state.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
     */
    public com.google.cloud.dataproc.v1.JobStatus.State getState() {
      @SuppressWarnings("deprecation")
      com.google.cloud.dataproc.v1.JobStatus.State result =
          com.google.cloud.dataproc.v1.JobStatus.State.valueOf(state_);
      return result == null ? com.google.cloud.dataproc.v1.JobStatus.State.UNRECOGNIZED : result;
    }
    /**
     *
     *
     * <pre>
     * Output only. A state message specifying the overall job state.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
     */
    public Builder setState(com.google.cloud.dataproc.v1.JobStatus.State value) {
      if (value == null) {
        throw new NullPointerException();
      }

      state_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. A state message specifying the overall job state.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.State state = 1;</code>
     */
    public Builder clearState() {

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

    private java.lang.Object details_ = "";
    /**
     *
     *
     * <pre>
     * Output only. Optional job state details, such as an error
     * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
     * </pre>
     *
     * <code>string details = 2;</code>
     */
    public java.lang.String getDetails() {
      java.lang.Object ref = details_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        details_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. Optional job state details, such as an error
     * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
     * </pre>
     *
     * <code>string details = 2;</code>
     */
    public com.google.protobuf.ByteString getDetailsBytes() {
      java.lang.Object ref = details_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        details_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. Optional job state details, such as an error
     * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
     * </pre>
     *
     * <code>string details = 2;</code>
     */
    public Builder setDetails(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }

      details_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. Optional job state details, such as an error
     * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
     * </pre>
     *
     * <code>string details = 2;</code>
     */
    public Builder clearDetails() {

      details_ = getDefaultInstance().getDetails();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. Optional job state details, such as an error
     * description if the state is &lt;code&gt;ERROR&lt;/code&gt;.
     * </pre>
     *
     * <code>string details = 2;</code>
     */
    public Builder setDetailsBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);

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

    private com.google.protobuf.Timestamp stateStartTime_ = null;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        stateStartTimeBuilder_;
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public boolean hasStateStartTime() {
      return stateStartTimeBuilder_ != null || stateStartTime_ != null;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public com.google.protobuf.Timestamp getStateStartTime() {
      if (stateStartTimeBuilder_ == null) {
        return stateStartTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : stateStartTime_;
      } else {
        return stateStartTimeBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public Builder setStateStartTime(com.google.protobuf.Timestamp value) {
      if (stateStartTimeBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        stateStartTime_ = value;
        onChanged();
      } else {
        stateStartTimeBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public Builder setStateStartTime(com.google.protobuf.Timestamp.Builder builderForValue) {
      if (stateStartTimeBuilder_ == null) {
        stateStartTime_ = builderForValue.build();
        onChanged();
      } else {
        stateStartTimeBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public Builder mergeStateStartTime(com.google.protobuf.Timestamp value) {
      if (stateStartTimeBuilder_ == null) {
        if (stateStartTime_ != null) {
          stateStartTime_ =
              com.google.protobuf.Timestamp.newBuilder(stateStartTime_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          stateStartTime_ = value;
        }
        onChanged();
      } else {
        stateStartTimeBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public Builder clearStateStartTime() {
      if (stateStartTimeBuilder_ == null) {
        stateStartTime_ = null;
        onChanged();
      } else {
        stateStartTime_ = null;
        stateStartTimeBuilder_ = null;
      }

      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public com.google.protobuf.Timestamp.Builder getStateStartTimeBuilder() {

      onChanged();
      return getStateStartTimeFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    public com.google.protobuf.TimestampOrBuilder getStateStartTimeOrBuilder() {
      if (stateStartTimeBuilder_ != null) {
        return stateStartTimeBuilder_.getMessageOrBuilder();
      } else {
        return stateStartTime_ == null
            ? com.google.protobuf.Timestamp.getDefaultInstance()
            : stateStartTime_;
      }
    }
    /**
     *
     *
     * <pre>
     * Output only. The time when this state was entered.
     * </pre>
     *
     * <code>.google.protobuf.Timestamp state_start_time = 6;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Timestamp,
            com.google.protobuf.Timestamp.Builder,
            com.google.protobuf.TimestampOrBuilder>
        getStateStartTimeFieldBuilder() {
      if (stateStartTimeBuilder_ == null) {
        stateStartTimeBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Timestamp,
                com.google.protobuf.Timestamp.Builder,
                com.google.protobuf.TimestampOrBuilder>(
                getStateStartTime(), getParentForChildren(), isClean());
        stateStartTime_ = null;
      }
      return stateStartTimeBuilder_;
    }

    private int substate_ = 0;
    /**
     *
     *
     * <pre>
     * Output only. Additional state information, which includes
     * status reported by the agent.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
     */
    public int getSubstateValue() {
      return substate_;
    }
    /**
     *
     *
     * <pre>
     * Output only. Additional state information, which includes
     * status reported by the agent.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
     */
    public Builder setSubstateValue(int value) {
      substate_ = value;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. Additional state information, which includes
     * status reported by the agent.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
     */
    public com.google.cloud.dataproc.v1.JobStatus.Substate getSubstate() {
      @SuppressWarnings("deprecation")
      com.google.cloud.dataproc.v1.JobStatus.Substate result =
          com.google.cloud.dataproc.v1.JobStatus.Substate.valueOf(substate_);
      return result == null ? com.google.cloud.dataproc.v1.JobStatus.Substate.UNRECOGNIZED : result;
    }
    /**
     *
     *
     * <pre>
     * Output only. Additional state information, which includes
     * status reported by the agent.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
     */
    public Builder setSubstate(com.google.cloud.dataproc.v1.JobStatus.Substate value) {
      if (value == null) {
        throw new NullPointerException();
      }

      substate_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Output only. Additional state information, which includes
     * status reported by the agent.
     * </pre>
     *
     * <code>.google.cloud.dataproc.v1.JobStatus.Substate substate = 7;</code>
     */
    public Builder clearSubstate() {

      substate_ = 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.dataproc.v1.JobStatus)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.dataproc.v1.JobStatus)
  private static final com.google.cloud.dataproc.v1.JobStatus DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.dataproc.v1.JobStatus();
  }

  public static com.google.cloud.dataproc.v1.JobStatus getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.cloud.dataproc.v1.JobStatus getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
