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

package com.google.cloud.policytroubleshooter.v1;

/**
 *
 *
 * <pre>
 * Response for [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy].
 * </pre>
 *
 * Protobuf type {@code google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse}
 */
public final class TroubleshootIamPolicyResponse extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse)
    TroubleshootIamPolicyResponseOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use TroubleshootIamPolicyResponse.newBuilder() to construct.
  private TroubleshootIamPolicyResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private TroubleshootIamPolicyResponse() {
    access_ = 0;
    explainedPolicies_ = java.util.Collections.emptyList();
  }

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

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

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.cloud.policytroubleshooter.v1.IAMCheckerProto
        .internal_static_google_cloud_policytroubleshooter_v1_TroubleshootIamPolicyResponse_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.policytroubleshooter.v1.IAMCheckerProto
        .internal_static_google_cloud_policytroubleshooter_v1_TroubleshootIamPolicyResponse_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.class,
            com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.Builder.class);
  }

  public static final int ACCESS_FIELD_NUMBER = 1;
  private int access_ = 0;
  /**
   *
   *
   * <pre>
   * Indicates whether the member has the specified permission for the specified
   * resource, based on evaluating all of the applicable IAM policies.
   * </pre>
   *
   * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
   *
   * @return The enum numeric value on the wire for access.
   */
  @java.lang.Override
  public int getAccessValue() {
    return access_;
  }
  /**
   *
   *
   * <pre>
   * Indicates whether the member has the specified permission for the specified
   * resource, based on evaluating all of the applicable IAM policies.
   * </pre>
   *
   * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
   *
   * @return The access.
   */
  @java.lang.Override
  public google.cloud.policytroubleshooter.v1.Explanations.AccessState getAccess() {
    google.cloud.policytroubleshooter.v1.Explanations.AccessState result =
        google.cloud.policytroubleshooter.v1.Explanations.AccessState.forNumber(access_);
    return result == null
        ? google.cloud.policytroubleshooter.v1.Explanations.AccessState.UNRECOGNIZED
        : result;
  }

  public static final int EXPLAINED_POLICIES_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private java.util.List<google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>
      explainedPolicies_;
  /**
   *
   *
   * <pre>
   * List of IAM policies that were evaluated to check the member's permissions,
   * with annotations to indicate how each policy contributed to the final
   * result.
   * The list of policies can include the policy for the resource itself. It can
   * also include policies that are inherited from higher levels of the resource
   * hierarchy, including the organization, the folder, and the project.
   * To learn more about the resource hierarchy, see
   * https://cloud.google.com/iam/help/resource-hierarchy.
   * </pre>
   *
   * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
   * </code>
   */
  @java.lang.Override
  public java.util.List<google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>
      getExplainedPoliciesList() {
    return explainedPolicies_;
  }
  /**
   *
   *
   * <pre>
   * List of IAM policies that were evaluated to check the member's permissions,
   * with annotations to indicate how each policy contributed to the final
   * result.
   * The list of policies can include the policy for the resource itself. It can
   * also include policies that are inherited from higher levels of the resource
   * hierarchy, including the organization, the folder, and the project.
   * To learn more about the resource hierarchy, see
   * https://cloud.google.com/iam/help/resource-hierarchy.
   * </pre>
   *
   * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
   * </code>
   */
  @java.lang.Override
  public java.util.List<
          ? extends google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder>
      getExplainedPoliciesOrBuilderList() {
    return explainedPolicies_;
  }
  /**
   *
   *
   * <pre>
   * List of IAM policies that were evaluated to check the member's permissions,
   * with annotations to indicate how each policy contributed to the final
   * result.
   * The list of policies can include the policy for the resource itself. It can
   * also include policies that are inherited from higher levels of the resource
   * hierarchy, including the organization, the folder, and the project.
   * To learn more about the resource hierarchy, see
   * https://cloud.google.com/iam/help/resource-hierarchy.
   * </pre>
   *
   * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
   * </code>
   */
  @java.lang.Override
  public int getExplainedPoliciesCount() {
    return explainedPolicies_.size();
  }
  /**
   *
   *
   * <pre>
   * List of IAM policies that were evaluated to check the member's permissions,
   * with annotations to indicate how each policy contributed to the final
   * result.
   * The list of policies can include the policy for the resource itself. It can
   * also include policies that are inherited from higher levels of the resource
   * hierarchy, including the organization, the folder, and the project.
   * To learn more about the resource hierarchy, see
   * https://cloud.google.com/iam/help/resource-hierarchy.
   * </pre>
   *
   * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
   * </code>
   */
  @java.lang.Override
  public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy getExplainedPolicies(
      int index) {
    return explainedPolicies_.get(index);
  }
  /**
   *
   *
   * <pre>
   * List of IAM policies that were evaluated to check the member's permissions,
   * with annotations to indicate how each policy contributed to the final
   * result.
   * The list of policies can include the policy for the resource itself. It can
   * also include policies that are inherited from higher levels of the resource
   * hierarchy, including the organization, the folder, and the project.
   * To learn more about the resource hierarchy, see
   * https://cloud.google.com/iam/help/resource-hierarchy.
   * </pre>
   *
   * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
   * </code>
   */
  @java.lang.Override
  public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder
      getExplainedPoliciesOrBuilder(int index) {
    return explainedPolicies_.get(index);
  }

  private byte memoizedIsInitialized = -1;

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

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
    if (access_
        != google.cloud.policytroubleshooter.v1.Explanations.AccessState.ACCESS_STATE_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, access_);
    }
    for (int i = 0; i < explainedPolicies_.size(); i++) {
      output.writeMessage(2, explainedPolicies_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (access_
        != google.cloud.policytroubleshooter.v1.Explanations.AccessState.ACCESS_STATE_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, access_);
    }
    for (int i = 0; i < explainedPolicies_.size(); i++) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(2, explainedPolicies_.get(i));
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse)) {
      return super.equals(obj);
    }
    com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse other =
        (com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse) obj;

    if (access_ != other.access_) return false;
    if (!getExplainedPoliciesList().equals(other.getExplainedPoliciesList())) return false;
    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + ACCESS_FIELD_NUMBER;
    hash = (53 * hash) + access_;
    if (getExplainedPoliciesCount() > 0) {
      hash = (37 * hash) + EXPLAINED_POLICIES_FIELD_NUMBER;
      hash = (53 * hash) + getExplainedPoliciesList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

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

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

  public static com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse 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.policytroubleshooter.v1.TroubleshootIamPolicyResponse 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>
   * Response for [TroubleshootIamPolicy][google.cloud.policytroubleshooter.v1.IamChecker.TroubleshootIamPolicy].
   * </pre>
   *
   * Protobuf type {@code google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse)
      com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponseOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.policytroubleshooter.v1.IAMCheckerProto
          .internal_static_google_cloud_policytroubleshooter_v1_TroubleshootIamPolicyResponse_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.policytroubleshooter.v1.IAMCheckerProto
          .internal_static_google_cloud_policytroubleshooter_v1_TroubleshootIamPolicyResponse_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.class,
              com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.Builder.class);
    }

    // Construct using
    // com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      access_ = 0;
      if (explainedPoliciesBuilder_ == null) {
        explainedPolicies_ = java.util.Collections.emptyList();
      } else {
        explainedPolicies_ = null;
        explainedPoliciesBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.policytroubleshooter.v1.IAMCheckerProto
          .internal_static_google_cloud_policytroubleshooter_v1_TroubleshootIamPolicyResponse_descriptor;
    }

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

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

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

    private void buildPartialRepeatedFields(
        com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse result) {
      if (explainedPoliciesBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          explainedPolicies_ = java.util.Collections.unmodifiableList(explainedPolicies_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.explainedPolicies_ = explainedPolicies_;
      } else {
        result.explainedPolicies_ = explainedPoliciesBuilder_.build();
      }
    }

    private void buildPartial0(
        com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.access_ = access_;
      }
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(
        com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse other) {
      if (other
          == com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse
              .getDefaultInstance()) return this;
      if (other.access_ != 0) {
        setAccessValue(other.getAccessValue());
      }
      if (explainedPoliciesBuilder_ == null) {
        if (!other.explainedPolicies_.isEmpty()) {
          if (explainedPolicies_.isEmpty()) {
            explainedPolicies_ = other.explainedPolicies_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureExplainedPoliciesIsMutable();
            explainedPolicies_.addAll(other.explainedPolicies_);
          }
          onChanged();
        }
      } else {
        if (!other.explainedPolicies_.isEmpty()) {
          if (explainedPoliciesBuilder_.isEmpty()) {
            explainedPoliciesBuilder_.dispose();
            explainedPoliciesBuilder_ = null;
            explainedPolicies_ = other.explainedPolicies_;
            bitField0_ = (bitField0_ & ~0x00000002);
            explainedPoliciesBuilder_ =
                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                    ? getExplainedPoliciesFieldBuilder()
                    : null;
          } else {
            explainedPoliciesBuilder_.addAllMessages(other.explainedPolicies_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      onChanged();
      return this;
    }

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

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8:
              {
                access_ = input.readEnum();
                bitField0_ |= 0x00000001;
                break;
              } // case 8
            case 18:
              {
                google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy m =
                    input.readMessage(
                        google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.parser(),
                        extensionRegistry);
                if (explainedPoliciesBuilder_ == null) {
                  ensureExplainedPoliciesIsMutable();
                  explainedPolicies_.add(m);
                } else {
                  explainedPoliciesBuilder_.addMessage(m);
                }
                break;
              } // case 18
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private int access_ = 0;
    /**
     *
     *
     * <pre>
     * Indicates whether the member has the specified permission for the specified
     * resource, based on evaluating all of the applicable IAM policies.
     * </pre>
     *
     * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     *
     * @return The enum numeric value on the wire for access.
     */
    @java.lang.Override
    public int getAccessValue() {
      return access_;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether the member has the specified permission for the specified
     * resource, based on evaluating all of the applicable IAM policies.
     * </pre>
     *
     * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     *
     * @param value The enum numeric value on the wire for access to set.
     * @return This builder for chaining.
     */
    public Builder setAccessValue(int value) {
      access_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether the member has the specified permission for the specified
     * resource, based on evaluating all of the applicable IAM policies.
     * </pre>
     *
     * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     *
     * @return The access.
     */
    @java.lang.Override
    public google.cloud.policytroubleshooter.v1.Explanations.AccessState getAccess() {
      google.cloud.policytroubleshooter.v1.Explanations.AccessState result =
          google.cloud.policytroubleshooter.v1.Explanations.AccessState.forNumber(access_);
      return result == null
          ? google.cloud.policytroubleshooter.v1.Explanations.AccessState.UNRECOGNIZED
          : result;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether the member has the specified permission for the specified
     * resource, based on evaluating all of the applicable IAM policies.
     * </pre>
     *
     * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     *
     * @param value The access to set.
     * @return This builder for chaining.
     */
    public Builder setAccess(google.cloud.policytroubleshooter.v1.Explanations.AccessState value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000001;
      access_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Indicates whether the member has the specified permission for the specified
     * resource, based on evaluating all of the applicable IAM policies.
     * </pre>
     *
     * <code>.google.cloud.policytroubleshooter.v1.AccessState access = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearAccess() {
      bitField0_ = (bitField0_ & ~0x00000001);
      access_ = 0;
      onChanged();
      return this;
    }

    private java.util.List<google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>
        explainedPolicies_ = java.util.Collections.emptyList();

    private void ensureExplainedPoliciesIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        explainedPolicies_ =
            new java.util.ArrayList<
                google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>(
                explainedPolicies_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy,
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder,
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder>
        explainedPoliciesBuilder_;

    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public java.util.List<google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>
        getExplainedPoliciesList() {
      if (explainedPoliciesBuilder_ == null) {
        return java.util.Collections.unmodifiableList(explainedPolicies_);
      } else {
        return explainedPoliciesBuilder_.getMessageList();
      }
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public int getExplainedPoliciesCount() {
      if (explainedPoliciesBuilder_ == null) {
        return explainedPolicies_.size();
      } else {
        return explainedPoliciesBuilder_.getCount();
      }
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy getExplainedPolicies(
        int index) {
      if (explainedPoliciesBuilder_ == null) {
        return explainedPolicies_.get(index);
      } else {
        return explainedPoliciesBuilder_.getMessage(index);
      }
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder setExplainedPolicies(
        int index, google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy value) {
      if (explainedPoliciesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.set(index, value);
        onChanged();
      } else {
        explainedPoliciesBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder setExplainedPolicies(
        int index,
        google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder builderForValue) {
      if (explainedPoliciesBuilder_ == null) {
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.set(index, builderForValue.build());
        onChanged();
      } else {
        explainedPoliciesBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder addExplainedPolicies(
        google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy value) {
      if (explainedPoliciesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.add(value);
        onChanged();
      } else {
        explainedPoliciesBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder addExplainedPolicies(
        int index, google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy value) {
      if (explainedPoliciesBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.add(index, value);
        onChanged();
      } else {
        explainedPoliciesBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder addExplainedPolicies(
        google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder builderForValue) {
      if (explainedPoliciesBuilder_ == null) {
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.add(builderForValue.build());
        onChanged();
      } else {
        explainedPoliciesBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder addExplainedPolicies(
        int index,
        google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder builderForValue) {
      if (explainedPoliciesBuilder_ == null) {
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.add(index, builderForValue.build());
        onChanged();
      } else {
        explainedPoliciesBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder addAllExplainedPolicies(
        java.lang.Iterable<
                ? extends google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy>
            values) {
      if (explainedPoliciesBuilder_ == null) {
        ensureExplainedPoliciesIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, explainedPolicies_);
        onChanged();
      } else {
        explainedPoliciesBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder clearExplainedPolicies() {
      if (explainedPoliciesBuilder_ == null) {
        explainedPolicies_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        explainedPoliciesBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public Builder removeExplainedPolicies(int index) {
      if (explainedPoliciesBuilder_ == null) {
        ensureExplainedPoliciesIsMutable();
        explainedPolicies_.remove(index);
        onChanged();
      } else {
        explainedPoliciesBuilder_.remove(index);
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder
        getExplainedPoliciesBuilder(int index) {
      return getExplainedPoliciesFieldBuilder().getBuilder(index);
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder
        getExplainedPoliciesOrBuilder(int index) {
      if (explainedPoliciesBuilder_ == null) {
        return explainedPolicies_.get(index);
      } else {
        return explainedPoliciesBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public java.util.List<
            ? extends google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder>
        getExplainedPoliciesOrBuilderList() {
      if (explainedPoliciesBuilder_ != null) {
        return explainedPoliciesBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(explainedPolicies_);
      }
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder
        addExplainedPoliciesBuilder() {
      return getExplainedPoliciesFieldBuilder()
          .addBuilder(
              google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy
                  .getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder
        addExplainedPoliciesBuilder(int index) {
      return getExplainedPoliciesFieldBuilder()
          .addBuilder(
              index,
              google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy
                  .getDefaultInstance());
    }
    /**
     *
     *
     * <pre>
     * List of IAM policies that were evaluated to check the member's permissions,
     * with annotations to indicate how each policy contributed to the final
     * result.
     * The list of policies can include the policy for the resource itself. It can
     * also include policies that are inherited from higher levels of the resource
     * hierarchy, including the organization, the folder, and the project.
     * To learn more about the resource hierarchy, see
     * https://cloud.google.com/iam/help/resource-hierarchy.
     * </pre>
     *
     * <code>repeated .google.cloud.policytroubleshooter.v1.ExplainedPolicy explained_policies = 2;
     * </code>
     */
    public java.util.List<google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder>
        getExplainedPoliciesBuilderList() {
      return getExplainedPoliciesFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilderV3<
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy,
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder,
            google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder>
        getExplainedPoliciesFieldBuilder() {
      if (explainedPoliciesBuilder_ == null) {
        explainedPoliciesBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilderV3<
                google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy,
                google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicy.Builder,
                google.cloud.policytroubleshooter.v1.Explanations.ExplainedPolicyOrBuilder>(
                explainedPolicies_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        explainedPolicies_ = null;
      }
      return explainedPoliciesBuilder_;
    }

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

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

    // @@protoc_insertion_point(builder_scope:google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse)
  }

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

  static {
    DEFAULT_INSTANCE = new com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse();
  }

  public static com.google.cloud.policytroubleshooter.v1.TroubleshootIamPolicyResponse
      getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

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