/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/devtools/clouderrorreporting/v1beta1/common.proto

package com.google.devtools.clouderrorreporting.v1beta1;

/**
 *
 *
 * <pre>
 * A description of the context in which an error occurred.
 * This data should be provided by the application when reporting an error,
 * unless the
 * error report has been generated automatically from Google App Engine logs.
 * </pre>
 *
 * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ErrorContext}
 */
public final class ErrorContext extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
    ErrorContextOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use ErrorContext.newBuilder() to construct.
  private ErrorContext(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private ErrorContext() {
    user_ = "";
  }

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
        .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
        .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.class,
            com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.Builder.class);
  }

  public static final int HTTP_REQUEST_FIELD_NUMBER = 1;
  private com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext httpRequest_;
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   *
   * @return Whether the httpRequest field is set.
   */
  @java.lang.Override
  public boolean hasHttpRequest() {
    return httpRequest_ != null;
  }
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   *
   * @return The httpRequest.
   */
  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext getHttpRequest() {
    return httpRequest_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.getDefaultInstance()
        : httpRequest_;
  }
  /**
   *
   *
   * <pre>
   * The HTTP request which was processed when the error was
   * triggered.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;</code>
   */
  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder
      getHttpRequestOrBuilder() {
    return httpRequest_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.getDefaultInstance()
        : httpRequest_;
  }

  public static final int USER_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private volatile java.lang.Object user_ = "";
  /**
   *
   *
   * <pre>
   * The user who caused or was affected by the crash.
   * This can be a user ID, an email address, or an arbitrary token that
   * uniquely identifies the user.
   * When sending an error report, leave this field empty if the user was not
   * logged in. In this case the
   * Error Reporting system will use other data, such as remote IP address, to
   * distinguish affected users. See `affected_users_count` in
   * `ErrorGroupStats`.
   * </pre>
   *
   * <code>string user = 2;</code>
   *
   * @return The user.
   */
  @java.lang.Override
  public java.lang.String getUser() {
    java.lang.Object ref = user_;
    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();
      user_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The user who caused or was affected by the crash.
   * This can be a user ID, an email address, or an arbitrary token that
   * uniquely identifies the user.
   * When sending an error report, leave this field empty if the user was not
   * logged in. In this case the
   * Error Reporting system will use other data, such as remote IP address, to
   * distinguish affected users. See `affected_users_count` in
   * `ErrorGroupStats`.
   * </pre>
   *
   * <code>string user = 2;</code>
   *
   * @return The bytes for user.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getUserBytes() {
    java.lang.Object ref = user_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      user_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int REPORT_LOCATION_FIELD_NUMBER = 3;
  private com.google.devtools.clouderrorreporting.v1beta1.SourceLocation reportLocation_;
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   *
   * @return Whether the reportLocation field is set.
   */
  @java.lang.Override
  public boolean hasReportLocation() {
    return reportLocation_ != null;
  }
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   *
   * @return The reportLocation.
   */
  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation getReportLocation() {
    return reportLocation_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
        : reportLocation_;
  }
  /**
   *
   *
   * <pre>
   * The location in the source code where the decision was made to
   * report the error, usually the place where it was logged.
   * For a logged exception this would be the source line where the
   * exception is logged, usually close to the place where it was
   * caught.
   * </pre>
   *
   * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
   */
  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder
      getReportLocationOrBuilder() {
    return reportLocation_ == null
        ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
        : reportLocation_;
  }

  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 (httpRequest_ != null) {
      output.writeMessage(1, getHttpRequest());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(user_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 2, user_);
    }
    if (reportLocation_ != null) {
      output.writeMessage(3, getReportLocation());
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (httpRequest_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getHttpRequest());
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(user_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, user_);
    }
    if (reportLocation_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getReportLocation());
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

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

    if (hasHttpRequest() != other.hasHttpRequest()) return false;
    if (hasHttpRequest()) {
      if (!getHttpRequest().equals(other.getHttpRequest())) return false;
    }
    if (!getUser().equals(other.getUser())) return false;
    if (hasReportLocation() != other.hasReportLocation()) return false;
    if (hasReportLocation()) {
      if (!getReportLocation().equals(other.getReportLocation())) return false;
    }
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    if (hasHttpRequest()) {
      hash = (37 * hash) + HTTP_REQUEST_FIELD_NUMBER;
      hash = (53 * hash) + getHttpRequest().hashCode();
    }
    hash = (37 * hash) + USER_FIELD_NUMBER;
    hash = (53 * hash) + getUser().hashCode();
    if (hasReportLocation()) {
      hash = (37 * hash) + REPORT_LOCATION_FIELD_NUMBER;
      hash = (53 * hash) + getReportLocation().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext 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.devtools.clouderrorreporting.v1beta1.ErrorContext parseDelimitedFrom(
      java.io.InputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext 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.devtools.clouderrorreporting.v1beta1.ErrorContext parseFrom(
      com.google.protobuf.CodedInputStream input) throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext 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.devtools.clouderrorreporting.v1beta1.ErrorContext 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 description of the context in which an error occurred.
   * This data should be provided by the application when reporting an error,
   * unless the
   * error report has been generated automatically from Google App Engine logs.
   * </pre>
   *
   * Protobuf type {@code google.devtools.clouderrorreporting.v1beta1.ErrorContext}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContextOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.class,
              com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.Builder.class);
    }

    // Construct using com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      httpRequest_ = null;
      if (httpRequestBuilder_ != null) {
        httpRequestBuilder_.dispose();
        httpRequestBuilder_ = null;
      }
      user_ = "";
      reportLocation_ = null;
      if (reportLocationBuilder_ != null) {
        reportLocationBuilder_.dispose();
        reportLocationBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.CommonProto
          .internal_static_google_devtools_clouderrorreporting_v1beta1_ErrorContext_descriptor;
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext
        getDefaultInstanceForType() {
      return com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.getDefaultInstance();
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext build() {
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContext result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext buildPartial() {
      com.google.devtools.clouderrorreporting.v1beta1.ErrorContext result =
          new com.google.devtools.clouderrorreporting.v1beta1.ErrorContext(this);
      if (bitField0_ != 0) {
        buildPartial0(result);
      }
      onBuilt();
      return result;
    }

    private void buildPartial0(
        com.google.devtools.clouderrorreporting.v1beta1.ErrorContext result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.httpRequest_ =
            httpRequestBuilder_ == null ? httpRequest_ : httpRequestBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.user_ = user_;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.reportLocation_ =
            reportLocationBuilder_ == null ? reportLocation_ : reportLocationBuilder_.build();
      }
    }

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

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

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

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

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

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

    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.google.devtools.clouderrorreporting.v1beta1.ErrorContext) {
        return mergeFrom((com.google.devtools.clouderrorreporting.v1beta1.ErrorContext) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.devtools.clouderrorreporting.v1beta1.ErrorContext other) {
      if (other
          == com.google.devtools.clouderrorreporting.v1beta1.ErrorContext.getDefaultInstance())
        return this;
      if (other.hasHttpRequest()) {
        mergeHttpRequest(other.getHttpRequest());
      }
      if (!other.getUser().isEmpty()) {
        user_ = other.user_;
        bitField0_ |= 0x00000002;
        onChanged();
      }
      if (other.hasReportLocation()) {
        mergeReportLocation(other.getReportLocation());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 10:
              {
                input.readMessage(getHttpRequestFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000001;
                break;
              } // case 10
            case 18:
              {
                user_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                input.readMessage(getReportLocationFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext httpRequest_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>
        httpRequestBuilder_;
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     *
     * @return Whether the httpRequest field is set.
     */
    public boolean hasHttpRequest() {
      return ((bitField0_ & 0x00000001) != 0);
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     *
     * @return The httpRequest.
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext getHttpRequest() {
      if (httpRequestBuilder_ == null) {
        return httpRequest_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext
                .getDefaultInstance()
            : httpRequest_;
      } else {
        return httpRequestBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder setHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext value) {
      if (httpRequestBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        httpRequest_ = value;
      } else {
        httpRequestBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder setHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder
            builderForValue) {
      if (httpRequestBuilder_ == null) {
        httpRequest_ = builderForValue.build();
      } else {
        httpRequestBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder mergeHttpRequest(
        com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext value) {
      if (httpRequestBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)
            && httpRequest_ != null
            && httpRequest_
                != com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext
                    .getDefaultInstance()) {
          getHttpRequestBuilder().mergeFrom(value);
        } else {
          httpRequest_ = value;
        }
      } else {
        httpRequestBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public Builder clearHttpRequest() {
      bitField0_ = (bitField0_ & ~0x00000001);
      httpRequest_ = null;
      if (httpRequestBuilder_ != null) {
        httpRequestBuilder_.dispose();
        httpRequestBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder
        getHttpRequestBuilder() {
      bitField0_ |= 0x00000001;
      onChanged();
      return getHttpRequestFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder
        getHttpRequestOrBuilder() {
      if (httpRequestBuilder_ != null) {
        return httpRequestBuilder_.getMessageOrBuilder();
      } else {
        return httpRequest_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext
                .getDefaultInstance()
            : httpRequest_;
      }
    }
    /**
     *
     *
     * <pre>
     * The HTTP request which was processed when the error was
     * triggered.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext http_request = 1;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>
        getHttpRequestFieldBuilder() {
      if (httpRequestBuilder_ == null) {
        httpRequestBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext,
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContext.Builder,
                com.google.devtools.clouderrorreporting.v1beta1.HttpRequestContextOrBuilder>(
                getHttpRequest(), getParentForChildren(), isClean());
        httpRequest_ = null;
      }
      return httpRequestBuilder_;
    }

    private java.lang.Object user_ = "";
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     *
     * @return The user.
     */
    public java.lang.String getUser() {
      java.lang.Object ref = user_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        user_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     *
     * @return The bytes for user.
     */
    public com.google.protobuf.ByteString getUserBytes() {
      java.lang.Object ref = user_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        user_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     *
     * @param value The user to set.
     * @return This builder for chaining.
     */
    public Builder setUser(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      user_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearUser() {
      user_ = getDefaultInstance().getUser();
      bitField0_ = (bitField0_ & ~0x00000002);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The user who caused or was affected by the crash.
     * This can be a user ID, an email address, or an arbitrary token that
     * uniquely identifies the user.
     * When sending an error report, leave this field empty if the user was not
     * logged in. In this case the
     * Error Reporting system will use other data, such as remote IP address, to
     * distinguish affected users. See `affected_users_count` in
     * `ErrorGroupStats`.
     * </pre>
     *
     * <code>string user = 2;</code>
     *
     * @param value The bytes for user to set.
     * @return This builder for chaining.
     */
    public Builder setUserBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      user_ = value;
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    private com.google.devtools.clouderrorreporting.v1beta1.SourceLocation reportLocation_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>
        reportLocationBuilder_;
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     *
     * @return Whether the reportLocation field is set.
     */
    public boolean hasReportLocation() {
      return ((bitField0_ & 0x00000004) != 0);
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     *
     * @return The reportLocation.
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation getReportLocation() {
      if (reportLocationBuilder_ == null) {
        return reportLocation_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
            : reportLocation_;
      } else {
        return reportLocationBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder setReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation value) {
      if (reportLocationBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        reportLocation_ = value;
      } else {
        reportLocationBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder setReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder builderForValue) {
      if (reportLocationBuilder_ == null) {
        reportLocation_ = builderForValue.build();
      } else {
        reportLocationBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder mergeReportLocation(
        com.google.devtools.clouderrorreporting.v1beta1.SourceLocation value) {
      if (reportLocationBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && reportLocation_ != null
            && reportLocation_
                != com.google.devtools.clouderrorreporting.v1beta1.SourceLocation
                    .getDefaultInstance()) {
          getReportLocationBuilder().mergeFrom(value);
        } else {
          reportLocation_ = value;
        }
      } else {
        reportLocationBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public Builder clearReportLocation() {
      bitField0_ = (bitField0_ & ~0x00000004);
      reportLocation_ = null;
      if (reportLocationBuilder_ != null) {
        reportLocationBuilder_.dispose();
        reportLocationBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder
        getReportLocationBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return getReportLocationFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    public com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder
        getReportLocationOrBuilder() {
      if (reportLocationBuilder_ != null) {
        return reportLocationBuilder_.getMessageOrBuilder();
      } else {
        return reportLocation_ == null
            ? com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.getDefaultInstance()
            : reportLocation_;
      }
    }
    /**
     *
     *
     * <pre>
     * The location in the source code where the decision was made to
     * report the error, usually the place where it was logged.
     * For a logged exception this would be the source line where the
     * exception is logged, usually close to the place where it was
     * caught.
     * </pre>
     *
     * <code>.google.devtools.clouderrorreporting.v1beta1.SourceLocation report_location = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
            com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>
        getReportLocationFieldBuilder() {
      if (reportLocationBuilder_ == null) {
        reportLocationBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocation,
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocation.Builder,
                com.google.devtools.clouderrorreporting.v1beta1.SourceLocationOrBuilder>(
                getReportLocation(), getParentForChildren(), isClean());
        reportLocation_ = null;
      }
      return reportLocationBuilder_;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
  }

  // @@protoc_insertion_point(class_scope:google.devtools.clouderrorreporting.v1beta1.ErrorContext)
  private static final com.google.devtools.clouderrorreporting.v1beta1.ErrorContext
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.devtools.clouderrorreporting.v1beta1.ErrorContext();
  }

  public static com.google.devtools.clouderrorreporting.v1beta1.ErrorContext getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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

  @java.lang.Override
  public com.google.devtools.clouderrorreporting.v1beta1.ErrorContext getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
