/*
 * 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/alloydb/v1alpha/service.proto

package com.google.cloud.alloydb.v1alpha;

/**
 *
 *
 * <pre>
 * Message for metadata that is specific to BatchCreateInstances API.
 * </pre>
 *
 * Protobuf type {@code google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata}
 */
public final class BatchCreateInstancesMetadata extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata)
    BatchCreateInstancesMetadataOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use BatchCreateInstancesMetadata.newBuilder() to construct.
  private BatchCreateInstancesMetadata(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private BatchCreateInstancesMetadata() {
    instanceTargets_ = com.google.protobuf.LazyStringArrayList.EMPTY;
  }

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

  @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.alloydb.v1alpha.ServiceProto
        .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 2:
        return internalGetInstanceStatuses();
      default:
        throw new RuntimeException("Invalid map field number: " + number);
    }
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.cloud.alloydb.v1alpha.ServiceProto
        .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.class,
            com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.Builder.class);
  }

  public static final int INSTANCE_TARGETS_FIELD_NUMBER = 1;

  @SuppressWarnings("serial")
  private com.google.protobuf.LazyStringList instanceTargets_;
  /**
   *
   *
   * <pre>
   * The instances being created in the API call. Each string in this list
   * is the server defined resource path for target instances in the request
   * and for the format of each string, see the comment on the Instance.name
   * field.
   * </pre>
   *
   * <code>repeated string instance_targets = 1;</code>
   *
   * @return A list containing the instanceTargets.
   */
  public com.google.protobuf.ProtocolStringList getInstanceTargetsList() {
    return instanceTargets_;
  }
  /**
   *
   *
   * <pre>
   * The instances being created in the API call. Each string in this list
   * is the server defined resource path for target instances in the request
   * and for the format of each string, see the comment on the Instance.name
   * field.
   * </pre>
   *
   * <code>repeated string instance_targets = 1;</code>
   *
   * @return The count of instanceTargets.
   */
  public int getInstanceTargetsCount() {
    return instanceTargets_.size();
  }
  /**
   *
   *
   * <pre>
   * The instances being created in the API call. Each string in this list
   * is the server defined resource path for target instances in the request
   * and for the format of each string, see the comment on the Instance.name
   * field.
   * </pre>
   *
   * <code>repeated string instance_targets = 1;</code>
   *
   * @param index The index of the element to return.
   * @return The instanceTargets at the given index.
   */
  public java.lang.String getInstanceTargets(int index) {
    return instanceTargets_.get(index);
  }
  /**
   *
   *
   * <pre>
   * The instances being created in the API call. Each string in this list
   * is the server defined resource path for target instances in the request
   * and for the format of each string, see the comment on the Instance.name
   * field.
   * </pre>
   *
   * <code>repeated string instance_targets = 1;</code>
   *
   * @param index The index of the value to return.
   * @return The bytes of the instanceTargets at the given index.
   */
  public com.google.protobuf.ByteString getInstanceTargetsBytes(int index) {
    return instanceTargets_.getByteString(index);
  }

  public static final int INSTANCE_STATUSES_FIELD_NUMBER = 2;

  private static final class InstanceStatusesDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        defaultEntry =
            com.google.protobuf.MapEntry
                .<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
                    newDefaultInstance(
                        com.google.cloud.alloydb.v1alpha.ServiceProto
                            .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_InstanceStatusesEntry_descriptor,
                        com.google.protobuf.WireFormat.FieldType.STRING,
                        "",
                        com.google.protobuf.WireFormat.FieldType.MESSAGE,
                        com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus
                            .getDefaultInstance());
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<
          java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
      instanceStatuses_;

  private com.google.protobuf.MapField<
          java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
      internalGetInstanceStatuses() {
    if (instanceStatuses_ == null) {
      return com.google.protobuf.MapField.emptyMapField(
          InstanceStatusesDefaultEntryHolder.defaultEntry);
    }
    return instanceStatuses_;
  }

  public int getInstanceStatusesCount() {
    return internalGetInstanceStatuses().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * A map representing state of the instances involved in the
   * BatchCreateInstances operation during the operation execution.
   * The instance state will be in STATE_UNSPECIFIED state if the instance has
   * not yet been picked up for processing.
   * The key of the map is the name of the instance resource.
   * For the format, see the comment on the Instance.name field.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
   * </code>
   */
  @java.lang.Override
  public boolean containsInstanceStatuses(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetInstanceStatuses().getMap().containsKey(key);
  }
  /** Use {@link #getInstanceStatusesMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
      getInstanceStatuses() {
    return getInstanceStatusesMap();
  }
  /**
   *
   *
   * <pre>
   * A map representing state of the instances involved in the
   * BatchCreateInstances operation during the operation execution.
   * The instance state will be in STATE_UNSPECIFIED state if the instance has
   * not yet been picked up for processing.
   * The key of the map is the name of the instance resource.
   * For the format, see the comment on the Instance.name field.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
   * </code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
      getInstanceStatusesMap() {
    return internalGetInstanceStatuses().getMap();
  }
  /**
   *
   *
   * <pre>
   * A map representing state of the instances involved in the
   * BatchCreateInstances operation during the operation execution.
   * The instance state will be in STATE_UNSPECIFIED state if the instance has
   * not yet been picked up for processing.
   * The key of the map is the name of the instance resource.
   * For the format, see the comment on the Instance.name field.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
   * </code>
   */
  @java.lang.Override
  public /* nullable */ com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus
      getInstanceStatusesOrDefault(
          java.lang.String key,
          /* nullable */
          com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        map = internalGetInstanceStatuses().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * A map representing state of the instances involved in the
   * BatchCreateInstances operation during the operation execution.
   * The instance state will be in STATE_UNSPECIFIED state if the instance has
   * not yet been picked up for processing.
   * The key of the map is the name of the instance resource.
   * For the format, see the comment on the Instance.name field.
   * </pre>
   *
   * <code>
   * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus getInstanceStatusesOrThrow(
      java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        map = internalGetInstanceStatuses().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }

  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 < instanceTargets_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, instanceTargets_.getRaw(i));
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetInstanceStatuses(), InstanceStatusesDefaultEntryHolder.defaultEntry, 2);
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    {
      int dataSize = 0;
      for (int i = 0; i < instanceTargets_.size(); i++) {
        dataSize += computeStringSizeNoTag(instanceTargets_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getInstanceTargetsList().size();
    }
    for (java.util.Map.Entry<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        entry : internalGetInstanceStatuses().getMap().entrySet()) {
      com.google.protobuf.MapEntry<
              java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
          instanceStatuses__ =
              InstanceStatusesDefaultEntryHolder.defaultEntry
                  .newBuilderForType()
                  .setKey(entry.getKey())
                  .setValue(entry.getValue())
                  .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, instanceStatuses__);
    }
    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.alloydb.v1alpha.BatchCreateInstancesMetadata)) {
      return super.equals(obj);
    }
    com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata other =
        (com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata) obj;

    if (!getInstanceTargetsList().equals(other.getInstanceTargetsList())) return false;
    if (!internalGetInstanceStatuses().equals(other.internalGetInstanceStatuses())) 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 (getInstanceTargetsCount() > 0) {
      hash = (37 * hash) + INSTANCE_TARGETS_FIELD_NUMBER;
      hash = (53 * hash) + getInstanceTargetsList().hashCode();
    }
    if (!internalGetInstanceStatuses().getMap().isEmpty()) {
      hash = (37 * hash) + INSTANCE_STATUSES_FIELD_NUMBER;
      hash = (53 * hash) + internalGetInstanceStatuses().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata parseFrom(
      java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

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

  public static com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata 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.alloydb.v1alpha.BatchCreateInstancesMetadata 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>
   * Message for metadata that is specific to BatchCreateInstances API.
   * </pre>
   *
   * Protobuf type {@code google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata)
      com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadataOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.alloydb.v1alpha.ServiceProto
          .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_descriptor;
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMapField(int number) {
      switch (number) {
        case 2:
          return internalGetInstanceStatuses();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 2:
          return internalGetMutableInstanceStatuses();
        default:
          throw new RuntimeException("Invalid map field number: " + number);
      }
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.alloydb.v1alpha.ServiceProto
          .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.class,
              com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.Builder.class);
    }

    // Construct using com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.newBuilder()
    private Builder() {}

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      instanceTargets_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      internalGetMutableInstanceStatuses().clear();
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.cloud.alloydb.v1alpha.ServiceProto
          .internal_static_google_cloud_alloydb_v1alpha_BatchCreateInstancesMetadata_descriptor;
    }

    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata
        getDefaultInstanceForType() {
      return com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.getDefaultInstance();
    }

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

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

    private void buildPartialRepeatedFields(
        com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata result) {
      if (((bitField0_ & 0x00000001) != 0)) {
        instanceTargets_ = instanceTargets_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000001);
      }
      result.instanceTargets_ = instanceTargets_;
    }

    private void buildPartial0(
        com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.instanceStatuses_ = internalGetInstanceStatuses();
        result.instanceStatuses_.makeImmutable();
      }
    }

    @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.alloydb.v1alpha.BatchCreateInstancesMetadata) {
        return mergeFrom((com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata) other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata other) {
      if (other
          == com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata.getDefaultInstance())
        return this;
      if (!other.instanceTargets_.isEmpty()) {
        if (instanceTargets_.isEmpty()) {
          instanceTargets_ = other.instanceTargets_;
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          ensureInstanceTargetsIsMutable();
          instanceTargets_.addAll(other.instanceTargets_);
        }
        onChanged();
      }
      internalGetMutableInstanceStatuses().mergeFrom(other.internalGetInstanceStatuses());
      bitField0_ |= 0x00000002;
      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:
              {
                java.lang.String s = input.readStringRequireUtf8();
                ensureInstanceTargetsIsMutable();
                instanceTargets_.add(s);
                break;
              } // case 10
            case 18:
              {
                com.google.protobuf.MapEntry<
                        java.lang.String,
                        com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
                    instanceStatuses__ =
                        input.readMessage(
                            InstanceStatusesDefaultEntryHolder.defaultEntry.getParserForType(),
                            extensionRegistry);
                internalGetMutableInstanceStatuses()
                    .getMutableMap()
                    .put(instanceStatuses__.getKey(), instanceStatuses__.getValue());
                bitField0_ |= 0x00000002;
                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 com.google.protobuf.LazyStringList instanceTargets_ =
        com.google.protobuf.LazyStringArrayList.EMPTY;

    private void ensureInstanceTargetsIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        instanceTargets_ = new com.google.protobuf.LazyStringArrayList(instanceTargets_);
        bitField0_ |= 0x00000001;
      }
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @return A list containing the instanceTargets.
     */
    public com.google.protobuf.ProtocolStringList getInstanceTargetsList() {
      return instanceTargets_.getUnmodifiableView();
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @return The count of instanceTargets.
     */
    public int getInstanceTargetsCount() {
      return instanceTargets_.size();
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param index The index of the element to return.
     * @return The instanceTargets at the given index.
     */
    public java.lang.String getInstanceTargets(int index) {
      return instanceTargets_.get(index);
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param index The index of the value to return.
     * @return The bytes of the instanceTargets at the given index.
     */
    public com.google.protobuf.ByteString getInstanceTargetsBytes(int index) {
      return instanceTargets_.getByteString(index);
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param index The index to set the value at.
     * @param value The instanceTargets to set.
     * @return This builder for chaining.
     */
    public Builder setInstanceTargets(int index, java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureInstanceTargetsIsMutable();
      instanceTargets_.set(index, value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param value The instanceTargets to add.
     * @return This builder for chaining.
     */
    public Builder addInstanceTargets(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      ensureInstanceTargetsIsMutable();
      instanceTargets_.add(value);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param values The instanceTargets to add.
     * @return This builder for chaining.
     */
    public Builder addAllInstanceTargets(java.lang.Iterable<java.lang.String> values) {
      ensureInstanceTargetsIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(values, instanceTargets_);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearInstanceTargets() {
      instanceTargets_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The instances being created in the API call. Each string in this list
     * is the server defined resource path for target instances in the request
     * and for the format of each string, see the comment on the Instance.name
     * field.
     * </pre>
     *
     * <code>repeated string instance_targets = 1;</code>
     *
     * @param value The bytes of the instanceTargets to add.
     * @return This builder for chaining.
     */
    public Builder addInstanceTargetsBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      ensureInstanceTargetsIsMutable();
      instanceTargets_.add(value);
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        instanceStatuses_;

    private com.google.protobuf.MapField<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        internalGetInstanceStatuses() {
      if (instanceStatuses_ == null) {
        return com.google.protobuf.MapField.emptyMapField(
            InstanceStatusesDefaultEntryHolder.defaultEntry);
      }
      return instanceStatuses_;
    }

    private com.google.protobuf.MapField<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        internalGetMutableInstanceStatuses() {
      if (instanceStatuses_ == null) {
        instanceStatuses_ =
            com.google.protobuf.MapField.newMapField(
                InstanceStatusesDefaultEntryHolder.defaultEntry);
      }
      if (!instanceStatuses_.isMutable()) {
        instanceStatuses_ = instanceStatuses_.copy();
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return instanceStatuses_;
    }

    public int getInstanceStatusesCount() {
      return internalGetInstanceStatuses().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    @java.lang.Override
    public boolean containsInstanceStatuses(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetInstanceStatuses().getMap().containsKey(key);
    }
    /** Use {@link #getInstanceStatusesMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        getInstanceStatuses() {
      return getInstanceStatusesMap();
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    @java.lang.Override
    public java.util.Map<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        getInstanceStatusesMap() {
      return internalGetInstanceStatuses().getMap();
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    @java.lang.Override
    public /* nullable */ com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus
        getInstanceStatusesOrDefault(
            java.lang.String key,
            /* nullable */
            com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
          map = internalGetInstanceStatuses().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus getInstanceStatusesOrThrow(
        java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
          map = internalGetInstanceStatuses().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearInstanceStatuses() {
      bitField0_ = (bitField0_ & ~0x00000002);
      internalGetMutableInstanceStatuses().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    public Builder removeInstanceStatuses(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableInstanceStatuses().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<
            java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
        getMutableInstanceStatuses() {
      bitField0_ |= 0x00000002;
      return internalGetMutableInstanceStatuses().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    public Builder putInstanceStatuses(
        java.lang.String key, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableInstanceStatuses().getMutableMap().put(key, value);
      bitField0_ |= 0x00000002;
      return this;
    }
    /**
     *
     *
     * <pre>
     * A map representing state of the instances involved in the
     * BatchCreateInstances operation during the operation execution.
     * The instance state will be in STATE_UNSPECIFIED state if the instance has
     * not yet been picked up for processing.
     * The key of the map is the name of the instance resource.
     * For the format, see the comment on the Instance.name field.
     * </pre>
     *
     * <code>
     * map&lt;string, .google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus&gt; instance_statuses = 2;
     * </code>
     */
    public Builder putAllInstanceStatuses(
        java.util.Map<java.lang.String, com.google.cloud.alloydb.v1alpha.BatchCreateInstanceStatus>
            values) {
      internalGetMutableInstanceStatuses().getMutableMap().putAll(values);
      bitField0_ |= 0x00000002;
      return this;
    }

    @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.alloydb.v1alpha.BatchCreateInstancesMetadata)
  }

  // @@protoc_insertion_point(class_scope:google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata)
  private static final com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata
      DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata();
  }

  public static com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.BatchCreateInstancesMetadata getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
