/*
 * Copyright 2026 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!
// NO CHECKED-IN PROTOBUF GENCODE
// source: google/iam/v1/policy.proto
// Protobuf Java Version: 4.33.2

package com.google.iam.v1;

/**
 *
 *
 * <pre>
 * The difference delta between two policies.
 * </pre>
 *
 * Protobuf type {@code google.iam.v1.PolicyDelta}
 */
@com.google.protobuf.Generated
public final class PolicyDelta extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.iam.v1.PolicyDelta)
    PolicyDeltaOrBuilder {
  private static final long serialVersionUID = 0L;

  static {
    com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion(
        com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC,
        /* major= */ 4,
        /* minor= */ 33,
        /* patch= */ 2,
        /* suffix= */ "",
        "PolicyDelta");
  }

  // Use PolicyDelta.newBuilder() to construct.
  private PolicyDelta(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
  }

  private PolicyDelta() {
    bindingDeltas_ = java.util.Collections.emptyList();
    auditConfigDeltas_ = java.util.Collections.emptyList();
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.iam.v1.PolicyProto.internal_static_google_iam_v1_PolicyDelta_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.iam.v1.PolicyProto
        .internal_static_google_iam_v1_PolicyDelta_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.iam.v1.PolicyDelta.class, com.google.iam.v1.PolicyDelta.Builder.class);
  }

  public static final int BINDING_DELTAS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private java.util.List<com.google.iam.v1.BindingDelta> bindingDeltas_;

  /**
   *
   *
   * <pre>
   * The delta for Bindings between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.iam.v1.BindingDelta> getBindingDeltasList() {
    return bindingDeltas_;
  }

  /**
   *
   *
   * <pre>
   * The delta for Bindings between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.iam.v1.BindingDeltaOrBuilder>
      getBindingDeltasOrBuilderList() {
    return bindingDeltas_;
  }

  /**
   *
   *
   * <pre>
   * The delta for Bindings between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
   */
  @java.lang.Override
  public int getBindingDeltasCount() {
    return bindingDeltas_.size();
  }

  /**
   *
   *
   * <pre>
   * The delta for Bindings between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
   */
  @java.lang.Override
  public com.google.iam.v1.BindingDelta getBindingDeltas(int index) {
    return bindingDeltas_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The delta for Bindings between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
   */
  @java.lang.Override
  public com.google.iam.v1.BindingDeltaOrBuilder getBindingDeltasOrBuilder(int index) {
    return bindingDeltas_.get(index);
  }

  public static final int AUDIT_CONFIG_DELTAS_FIELD_NUMBER = 2;

  @SuppressWarnings("serial")
  private java.util.List<com.google.iam.v1.AuditConfigDelta> auditConfigDeltas_;

  /**
   *
   *
   * <pre>
   * The delta for AuditConfigs between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
   */
  @java.lang.Override
  public java.util.List<com.google.iam.v1.AuditConfigDelta> getAuditConfigDeltasList() {
    return auditConfigDeltas_;
  }

  /**
   *
   *
   * <pre>
   * The delta for AuditConfigs between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
   */
  @java.lang.Override
  public java.util.List<? extends com.google.iam.v1.AuditConfigDeltaOrBuilder>
      getAuditConfigDeltasOrBuilderList() {
    return auditConfigDeltas_;
  }

  /**
   *
   *
   * <pre>
   * The delta for AuditConfigs between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
   */
  @java.lang.Override
  public int getAuditConfigDeltasCount() {
    return auditConfigDeltas_.size();
  }

  /**
   *
   *
   * <pre>
   * The delta for AuditConfigs between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
   */
  @java.lang.Override
  public com.google.iam.v1.AuditConfigDelta getAuditConfigDeltas(int index) {
    return auditConfigDeltas_.get(index);
  }

  /**
   *
   *
   * <pre>
   * The delta for AuditConfigs between two policies.
   * </pre>
   *
   * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
   */
  @java.lang.Override
  public com.google.iam.v1.AuditConfigDeltaOrBuilder getAuditConfigDeltasOrBuilder(int index) {
    return auditConfigDeltas_.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 {
    for (int i = 0; i < bindingDeltas_.size(); i++) {
      output.writeMessage(1, bindingDeltas_.get(i));
    }
    for (int i = 0; i < auditConfigDeltas_.size(); i++) {
      output.writeMessage(2, auditConfigDeltas_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    for (int i = 0; i < bindingDeltas_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, bindingDeltas_.get(i));
    }
    for (int i = 0; i < auditConfigDeltas_.size(); i++) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(2, auditConfigDeltas_.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.iam.v1.PolicyDelta)) {
      return super.equals(obj);
    }
    com.google.iam.v1.PolicyDelta other = (com.google.iam.v1.PolicyDelta) obj;

    if (!getBindingDeltasList().equals(other.getBindingDeltasList())) return false;
    if (!getAuditConfigDeltasList().equals(other.getAuditConfigDeltasList())) 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 (getBindingDeltasCount() > 0) {
      hash = (37 * hash) + BINDING_DELTAS_FIELD_NUMBER;
      hash = (53 * hash) + getBindingDeltasList().hashCode();
    }
    if (getAuditConfigDeltasCount() > 0) {
      hash = (37 * hash) + AUDIT_CONFIG_DELTAS_FIELD_NUMBER;
      hash = (53 * hash) + getAuditConfigDeltasList().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

  public static com.google.iam.v1.PolicyDelta parseFrom(
      java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }

  public static com.google.iam.v1.PolicyDelta parseFrom(com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

  public static com.google.iam.v1.PolicyDelta parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.iam.v1.PolicyDelta parseFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.iam.v1.PolicyDelta parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(PARSER, input);
  }

  public static com.google.iam.v1.PolicyDelta parseDelimitedFrom(
      java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseDelimitedWithIOException(
        PARSER, input, extensionRegistry);
  }

  public static com.google.iam.v1.PolicyDelta parseFrom(com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(PARSER, input);
  }

  public static com.google.iam.v1.PolicyDelta parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.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.iam.v1.PolicyDelta 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.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * The difference delta between two policies.
   * </pre>
   *
   * Protobuf type {@code google.iam.v1.PolicyDelta}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.iam.v1.PolicyDelta)
      com.google.iam.v1.PolicyDeltaOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.iam.v1.PolicyProto.internal_static_google_iam_v1_PolicyDelta_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.iam.v1.PolicyProto
          .internal_static_google_iam_v1_PolicyDelta_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.iam.v1.PolicyDelta.class, com.google.iam.v1.PolicyDelta.Builder.class);
    }

    // Construct using com.google.iam.v1.PolicyDelta.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (bindingDeltasBuilder_ == null) {
        bindingDeltas_ = java.util.Collections.emptyList();
      } else {
        bindingDeltas_ = null;
        bindingDeltasBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000001);
      if (auditConfigDeltasBuilder_ == null) {
        auditConfigDeltas_ = java.util.Collections.emptyList();
      } else {
        auditConfigDeltas_ = null;
        auditConfigDeltasBuilder_.clear();
      }
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.iam.v1.PolicyProto.internal_static_google_iam_v1_PolicyDelta_descriptor;
    }

    @java.lang.Override
    public com.google.iam.v1.PolicyDelta getDefaultInstanceForType() {
      return com.google.iam.v1.PolicyDelta.getDefaultInstance();
    }

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

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

    private void buildPartialRepeatedFields(com.google.iam.v1.PolicyDelta result) {
      if (bindingDeltasBuilder_ == null) {
        if (((bitField0_ & 0x00000001) != 0)) {
          bindingDeltas_ = java.util.Collections.unmodifiableList(bindingDeltas_);
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.bindingDeltas_ = bindingDeltas_;
      } else {
        result.bindingDeltas_ = bindingDeltasBuilder_.build();
      }
      if (auditConfigDeltasBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)) {
          auditConfigDeltas_ = java.util.Collections.unmodifiableList(auditConfigDeltas_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.auditConfigDeltas_ = auditConfigDeltas_;
      } else {
        result.auditConfigDeltas_ = auditConfigDeltasBuilder_.build();
      }
    }

    private void buildPartial0(com.google.iam.v1.PolicyDelta result) {
      int from_bitField0_ = bitField0_;
    }

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

    public Builder mergeFrom(com.google.iam.v1.PolicyDelta other) {
      if (other == com.google.iam.v1.PolicyDelta.getDefaultInstance()) return this;
      if (bindingDeltasBuilder_ == null) {
        if (!other.bindingDeltas_.isEmpty()) {
          if (bindingDeltas_.isEmpty()) {
            bindingDeltas_ = other.bindingDeltas_;
            bitField0_ = (bitField0_ & ~0x00000001);
          } else {
            ensureBindingDeltasIsMutable();
            bindingDeltas_.addAll(other.bindingDeltas_);
          }
          onChanged();
        }
      } else {
        if (!other.bindingDeltas_.isEmpty()) {
          if (bindingDeltasBuilder_.isEmpty()) {
            bindingDeltasBuilder_.dispose();
            bindingDeltasBuilder_ = null;
            bindingDeltas_ = other.bindingDeltas_;
            bitField0_ = (bitField0_ & ~0x00000001);
            bindingDeltasBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetBindingDeltasFieldBuilder()
                    : null;
          } else {
            bindingDeltasBuilder_.addAllMessages(other.bindingDeltas_);
          }
        }
      }
      if (auditConfigDeltasBuilder_ == null) {
        if (!other.auditConfigDeltas_.isEmpty()) {
          if (auditConfigDeltas_.isEmpty()) {
            auditConfigDeltas_ = other.auditConfigDeltas_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureAuditConfigDeltasIsMutable();
            auditConfigDeltas_.addAll(other.auditConfigDeltas_);
          }
          onChanged();
        }
      } else {
        if (!other.auditConfigDeltas_.isEmpty()) {
          if (auditConfigDeltasBuilder_.isEmpty()) {
            auditConfigDeltasBuilder_.dispose();
            auditConfigDeltasBuilder_ = null;
            auditConfigDeltas_ = other.auditConfigDeltas_;
            bitField0_ = (bitField0_ & ~0x00000002);
            auditConfigDeltasBuilder_ =
                com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders
                    ? internalGetAuditConfigDeltasFieldBuilder()
                    : null;
          } else {
            auditConfigDeltasBuilder_.addAllMessages(other.auditConfigDeltas_);
          }
        }
      }
      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:
              {
                com.google.iam.v1.BindingDelta m =
                    input.readMessage(com.google.iam.v1.BindingDelta.parser(), extensionRegistry);
                if (bindingDeltasBuilder_ == null) {
                  ensureBindingDeltasIsMutable();
                  bindingDeltas_.add(m);
                } else {
                  bindingDeltasBuilder_.addMessage(m);
                }
                break;
              } // case 10
            case 18:
              {
                com.google.iam.v1.AuditConfigDelta m =
                    input.readMessage(
                        com.google.iam.v1.AuditConfigDelta.parser(), extensionRegistry);
                if (auditConfigDeltasBuilder_ == null) {
                  ensureAuditConfigDeltasIsMutable();
                  auditConfigDeltas_.add(m);
                } else {
                  auditConfigDeltasBuilder_.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 java.util.List<com.google.iam.v1.BindingDelta> bindingDeltas_ =
        java.util.Collections.emptyList();

    private void ensureBindingDeltasIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        bindingDeltas_ = new java.util.ArrayList<com.google.iam.v1.BindingDelta>(bindingDeltas_);
        bitField0_ |= 0x00000001;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.iam.v1.BindingDelta,
            com.google.iam.v1.BindingDelta.Builder,
            com.google.iam.v1.BindingDeltaOrBuilder>
        bindingDeltasBuilder_;

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public java.util.List<com.google.iam.v1.BindingDelta> getBindingDeltasList() {
      if (bindingDeltasBuilder_ == null) {
        return java.util.Collections.unmodifiableList(bindingDeltas_);
      } else {
        return bindingDeltasBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public int getBindingDeltasCount() {
      if (bindingDeltasBuilder_ == null) {
        return bindingDeltas_.size();
      } else {
        return bindingDeltasBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public com.google.iam.v1.BindingDelta getBindingDeltas(int index) {
      if (bindingDeltasBuilder_ == null) {
        return bindingDeltas_.get(index);
      } else {
        return bindingDeltasBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder setBindingDeltas(int index, com.google.iam.v1.BindingDelta value) {
      if (bindingDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureBindingDeltasIsMutable();
        bindingDeltas_.set(index, value);
        onChanged();
      } else {
        bindingDeltasBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder setBindingDeltas(
        int index, com.google.iam.v1.BindingDelta.Builder builderForValue) {
      if (bindingDeltasBuilder_ == null) {
        ensureBindingDeltasIsMutable();
        bindingDeltas_.set(index, builderForValue.build());
        onChanged();
      } else {
        bindingDeltasBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder addBindingDeltas(com.google.iam.v1.BindingDelta value) {
      if (bindingDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureBindingDeltasIsMutable();
        bindingDeltas_.add(value);
        onChanged();
      } else {
        bindingDeltasBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder addBindingDeltas(int index, com.google.iam.v1.BindingDelta value) {
      if (bindingDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureBindingDeltasIsMutable();
        bindingDeltas_.add(index, value);
        onChanged();
      } else {
        bindingDeltasBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder addBindingDeltas(com.google.iam.v1.BindingDelta.Builder builderForValue) {
      if (bindingDeltasBuilder_ == null) {
        ensureBindingDeltasIsMutable();
        bindingDeltas_.add(builderForValue.build());
        onChanged();
      } else {
        bindingDeltasBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder addBindingDeltas(
        int index, com.google.iam.v1.BindingDelta.Builder builderForValue) {
      if (bindingDeltasBuilder_ == null) {
        ensureBindingDeltasIsMutable();
        bindingDeltas_.add(index, builderForValue.build());
        onChanged();
      } else {
        bindingDeltasBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder addAllBindingDeltas(
        java.lang.Iterable<? extends com.google.iam.v1.BindingDelta> values) {
      if (bindingDeltasBuilder_ == null) {
        ensureBindingDeltasIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, bindingDeltas_);
        onChanged();
      } else {
        bindingDeltasBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder clearBindingDeltas() {
      if (bindingDeltasBuilder_ == null) {
        bindingDeltas_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
      } else {
        bindingDeltasBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public Builder removeBindingDeltas(int index) {
      if (bindingDeltasBuilder_ == null) {
        ensureBindingDeltasIsMutable();
        bindingDeltas_.remove(index);
        onChanged();
      } else {
        bindingDeltasBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public com.google.iam.v1.BindingDelta.Builder getBindingDeltasBuilder(int index) {
      return internalGetBindingDeltasFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public com.google.iam.v1.BindingDeltaOrBuilder getBindingDeltasOrBuilder(int index) {
      if (bindingDeltasBuilder_ == null) {
        return bindingDeltas_.get(index);
      } else {
        return bindingDeltasBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public java.util.List<? extends com.google.iam.v1.BindingDeltaOrBuilder>
        getBindingDeltasOrBuilderList() {
      if (bindingDeltasBuilder_ != null) {
        return bindingDeltasBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(bindingDeltas_);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public com.google.iam.v1.BindingDelta.Builder addBindingDeltasBuilder() {
      return internalGetBindingDeltasFieldBuilder()
          .addBuilder(com.google.iam.v1.BindingDelta.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public com.google.iam.v1.BindingDelta.Builder addBindingDeltasBuilder(int index) {
      return internalGetBindingDeltasFieldBuilder()
          .addBuilder(index, com.google.iam.v1.BindingDelta.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The delta for Bindings between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.BindingDelta binding_deltas = 1;</code>
     */
    public java.util.List<com.google.iam.v1.BindingDelta.Builder> getBindingDeltasBuilderList() {
      return internalGetBindingDeltasFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.iam.v1.BindingDelta,
            com.google.iam.v1.BindingDelta.Builder,
            com.google.iam.v1.BindingDeltaOrBuilder>
        internalGetBindingDeltasFieldBuilder() {
      if (bindingDeltasBuilder_ == null) {
        bindingDeltasBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.iam.v1.BindingDelta,
                com.google.iam.v1.BindingDelta.Builder,
                com.google.iam.v1.BindingDeltaOrBuilder>(
                bindingDeltas_,
                ((bitField0_ & 0x00000001) != 0),
                getParentForChildren(),
                isClean());
        bindingDeltas_ = null;
      }
      return bindingDeltasBuilder_;
    }

    private java.util.List<com.google.iam.v1.AuditConfigDelta> auditConfigDeltas_ =
        java.util.Collections.emptyList();

    private void ensureAuditConfigDeltasIsMutable() {
      if (!((bitField0_ & 0x00000002) != 0)) {
        auditConfigDeltas_ =
            new java.util.ArrayList<com.google.iam.v1.AuditConfigDelta>(auditConfigDeltas_);
        bitField0_ |= 0x00000002;
      }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.iam.v1.AuditConfigDelta,
            com.google.iam.v1.AuditConfigDelta.Builder,
            com.google.iam.v1.AuditConfigDeltaOrBuilder>
        auditConfigDeltasBuilder_;

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public java.util.List<com.google.iam.v1.AuditConfigDelta> getAuditConfigDeltasList() {
      if (auditConfigDeltasBuilder_ == null) {
        return java.util.Collections.unmodifiableList(auditConfigDeltas_);
      } else {
        return auditConfigDeltasBuilder_.getMessageList();
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public int getAuditConfigDeltasCount() {
      if (auditConfigDeltasBuilder_ == null) {
        return auditConfigDeltas_.size();
      } else {
        return auditConfigDeltasBuilder_.getCount();
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public com.google.iam.v1.AuditConfigDelta getAuditConfigDeltas(int index) {
      if (auditConfigDeltasBuilder_ == null) {
        return auditConfigDeltas_.get(index);
      } else {
        return auditConfigDeltasBuilder_.getMessage(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder setAuditConfigDeltas(int index, com.google.iam.v1.AuditConfigDelta value) {
      if (auditConfigDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.set(index, value);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.setMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder setAuditConfigDeltas(
        int index, com.google.iam.v1.AuditConfigDelta.Builder builderForValue) {
      if (auditConfigDeltasBuilder_ == null) {
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.set(index, builderForValue.build());
        onChanged();
      } else {
        auditConfigDeltasBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder addAuditConfigDeltas(com.google.iam.v1.AuditConfigDelta value) {
      if (auditConfigDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.add(value);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.addMessage(value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder addAuditConfigDeltas(int index, com.google.iam.v1.AuditConfigDelta value) {
      if (auditConfigDeltasBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.add(index, value);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.addMessage(index, value);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder addAuditConfigDeltas(
        com.google.iam.v1.AuditConfigDelta.Builder builderForValue) {
      if (auditConfigDeltasBuilder_ == null) {
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.add(builderForValue.build());
        onChanged();
      } else {
        auditConfigDeltasBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder addAuditConfigDeltas(
        int index, com.google.iam.v1.AuditConfigDelta.Builder builderForValue) {
      if (auditConfigDeltasBuilder_ == null) {
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.add(index, builderForValue.build());
        onChanged();
      } else {
        auditConfigDeltasBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder addAllAuditConfigDeltas(
        java.lang.Iterable<? extends com.google.iam.v1.AuditConfigDelta> values) {
      if (auditConfigDeltasBuilder_ == null) {
        ensureAuditConfigDeltasIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(values, auditConfigDeltas_);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.addAllMessages(values);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder clearAuditConfigDeltas() {
      if (auditConfigDeltasBuilder_ == null) {
        auditConfigDeltas_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.clear();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public Builder removeAuditConfigDeltas(int index) {
      if (auditConfigDeltasBuilder_ == null) {
        ensureAuditConfigDeltasIsMutable();
        auditConfigDeltas_.remove(index);
        onChanged();
      } else {
        auditConfigDeltasBuilder_.remove(index);
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public com.google.iam.v1.AuditConfigDelta.Builder getAuditConfigDeltasBuilder(int index) {
      return internalGetAuditConfigDeltasFieldBuilder().getBuilder(index);
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public com.google.iam.v1.AuditConfigDeltaOrBuilder getAuditConfigDeltasOrBuilder(int index) {
      if (auditConfigDeltasBuilder_ == null) {
        return auditConfigDeltas_.get(index);
      } else {
        return auditConfigDeltasBuilder_.getMessageOrBuilder(index);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public java.util.List<? extends com.google.iam.v1.AuditConfigDeltaOrBuilder>
        getAuditConfigDeltasOrBuilderList() {
      if (auditConfigDeltasBuilder_ != null) {
        return auditConfigDeltasBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(auditConfigDeltas_);
      }
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public com.google.iam.v1.AuditConfigDelta.Builder addAuditConfigDeltasBuilder() {
      return internalGetAuditConfigDeltasFieldBuilder()
          .addBuilder(com.google.iam.v1.AuditConfigDelta.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public com.google.iam.v1.AuditConfigDelta.Builder addAuditConfigDeltasBuilder(int index) {
      return internalGetAuditConfigDeltasFieldBuilder()
          .addBuilder(index, com.google.iam.v1.AuditConfigDelta.getDefaultInstance());
    }

    /**
     *
     *
     * <pre>
     * The delta for AuditConfigs between two policies.
     * </pre>
     *
     * <code>repeated .google.iam.v1.AuditConfigDelta audit_config_deltas = 2;</code>
     */
    public java.util.List<com.google.iam.v1.AuditConfigDelta.Builder>
        getAuditConfigDeltasBuilderList() {
      return internalGetAuditConfigDeltasFieldBuilder().getBuilderList();
    }

    private com.google.protobuf.RepeatedFieldBuilder<
            com.google.iam.v1.AuditConfigDelta,
            com.google.iam.v1.AuditConfigDelta.Builder,
            com.google.iam.v1.AuditConfigDeltaOrBuilder>
        internalGetAuditConfigDeltasFieldBuilder() {
      if (auditConfigDeltasBuilder_ == null) {
        auditConfigDeltasBuilder_ =
            new com.google.protobuf.RepeatedFieldBuilder<
                com.google.iam.v1.AuditConfigDelta,
                com.google.iam.v1.AuditConfigDelta.Builder,
                com.google.iam.v1.AuditConfigDeltaOrBuilder>(
                auditConfigDeltas_,
                ((bitField0_ & 0x00000002) != 0),
                getParentForChildren(),
                isClean());
        auditConfigDeltas_ = null;
      }
      return auditConfigDeltasBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.iam.v1.PolicyDelta)
  }

  // @@protoc_insertion_point(class_scope:google.iam.v1.PolicyDelta)
  private static final com.google.iam.v1.PolicyDelta DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.iam.v1.PolicyDelta();
  }

  public static com.google.iam.v1.PolicyDelta getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.iam.v1.PolicyDelta getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
