/*
 * 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/resources.proto

package com.google.cloud.alloydb.v1alpha;

/**
 *
 *
 * <pre>
 * Message describing the user-specified automated backup policy.
 * All fields in the automated backup policy are optional. Defaults for each
 * field are provided if they are not set.
 * </pre>
 *
 * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy}
 */
public final class AutomatedBackupPolicy extends com.google.protobuf.GeneratedMessageV3
    implements
    // @@protoc_insertion_point(message_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy)
    AutomatedBackupPolicyOrBuilder {
  private static final long serialVersionUID = 0L;
  // Use AutomatedBackupPolicy.newBuilder() to construct.
  private AutomatedBackupPolicy(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }

  private AutomatedBackupPolicy() {
    location_ = "";
  }

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

  @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.ResourcesProto
        .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_descriptor;
  }

  @SuppressWarnings({"rawtypes"})
  @java.lang.Override
  protected com.google.protobuf.MapField internalGetMapField(int number) {
    switch (number) {
      case 7:
        return internalGetLabels();
      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.ResourcesProto
        .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.class,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.Builder.class);
  }

  public interface WeeklyScheduleOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    java.util.List<com.google.type.TimeOfDay> getStartTimesList();
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    com.google.type.TimeOfDay getStartTimes(int index);
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    int getStartTimesCount();
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    java.util.List<? extends com.google.type.TimeOfDayOrBuilder> getStartTimesOrBuilderList();
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    com.google.type.TimeOfDayOrBuilder getStartTimesOrBuilder(int index);

    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return A list containing the daysOfWeek.
     */
    java.util.List<com.google.type.DayOfWeek> getDaysOfWeekList();
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return The count of daysOfWeek.
     */
    int getDaysOfWeekCount();
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @param index The index of the element to return.
     * @return The daysOfWeek at the given index.
     */
    com.google.type.DayOfWeek getDaysOfWeek(int index);
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return A list containing the enum numeric values on the wire for daysOfWeek.
     */
    java.util.List<java.lang.Integer> getDaysOfWeekValueList();
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @param index The index of the value to return.
     * @return The enum numeric value on the wire of daysOfWeek at the given index.
     */
    int getDaysOfWeekValue(int index);
  }
  /**
   *
   *
   * <pre>
   * A weekly schedule starts a backup at prescribed start times within a
   * day, for the specified days of the week.
   * The weekly schedule message is flexible and can be used to create many
   * types of schedules. For example, to have a daily backup that starts at
   * 22:00, configure the `start_times` field to have one element "22:00" and
   * the `days_of_week` field to have all seven days of the week.
   * </pre>
   *
   * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule}
   */
  public static final class WeeklySchedule extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule)
      WeeklyScheduleOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use WeeklySchedule.newBuilder() to construct.
    private WeeklySchedule(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private WeeklySchedule() {
      startTimes_ = java.util.Collections.emptyList();
      daysOfWeek_ = java.util.Collections.emptyList();
    }

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

    @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.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_WeeklySchedule_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.alloydb.v1alpha.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_WeeklySchedule_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.class,
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder.class);
    }

    public static final int START_TIMES_FIELD_NUMBER = 1;

    @SuppressWarnings("serial")
    private java.util.List<com.google.type.TimeOfDay> startTimes_;
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    @java.lang.Override
    public java.util.List<com.google.type.TimeOfDay> getStartTimesList() {
      return startTimes_;
    }
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    @java.lang.Override
    public java.util.List<? extends com.google.type.TimeOfDayOrBuilder>
        getStartTimesOrBuilderList() {
      return startTimes_;
    }
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    @java.lang.Override
    public int getStartTimesCount() {
      return startTimes_.size();
    }
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    @java.lang.Override
    public com.google.type.TimeOfDay getStartTimes(int index) {
      return startTimes_.get(index);
    }
    /**
     *
     *
     * <pre>
     * The times during the day to start a backup. The start times are assumed
     * to be in UTC and to be an exact hour (e.g., 04:00:00).
     * If no start times are provided, a single fixed start time is chosen
     * arbitrarily.
     * </pre>
     *
     * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
     */
    @java.lang.Override
    public com.google.type.TimeOfDayOrBuilder getStartTimesOrBuilder(int index) {
      return startTimes_.get(index);
    }

    public static final int DAYS_OF_WEEK_FIELD_NUMBER = 2;

    @SuppressWarnings("serial")
    private java.util.List<java.lang.Integer> daysOfWeek_;

    private static final com.google.protobuf.Internal.ListAdapter.Converter<
            java.lang.Integer, com.google.type.DayOfWeek>
        daysOfWeek_converter_ =
            new com.google.protobuf.Internal.ListAdapter.Converter<
                java.lang.Integer, com.google.type.DayOfWeek>() {
              public com.google.type.DayOfWeek convert(java.lang.Integer from) {
                com.google.type.DayOfWeek result = com.google.type.DayOfWeek.forNumber(from);
                return result == null ? com.google.type.DayOfWeek.UNRECOGNIZED : result;
              }
            };
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return A list containing the daysOfWeek.
     */
    @java.lang.Override
    public java.util.List<com.google.type.DayOfWeek> getDaysOfWeekList() {
      return new com.google.protobuf.Internal.ListAdapter<
          java.lang.Integer, com.google.type.DayOfWeek>(daysOfWeek_, daysOfWeek_converter_);
    }
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return The count of daysOfWeek.
     */
    @java.lang.Override
    public int getDaysOfWeekCount() {
      return daysOfWeek_.size();
    }
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @param index The index of the element to return.
     * @return The daysOfWeek at the given index.
     */
    @java.lang.Override
    public com.google.type.DayOfWeek getDaysOfWeek(int index) {
      return daysOfWeek_converter_.convert(daysOfWeek_.get(index));
    }
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @return A list containing the enum numeric values on the wire for daysOfWeek.
     */
    @java.lang.Override
    public java.util.List<java.lang.Integer> getDaysOfWeekValueList() {
      return daysOfWeek_;
    }
    /**
     *
     *
     * <pre>
     * The days of the week to perform a backup.
     * If this field is left empty, the default of every day of the week is
     * used.
     * </pre>
     *
     * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
     *
     * @param index The index of the value to return.
     * @return The enum numeric value on the wire of daysOfWeek at the given index.
     */
    @java.lang.Override
    public int getDaysOfWeekValue(int index) {
      return daysOfWeek_.get(index);
    }

    private int daysOfWeekMemoizedSerializedSize;

    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 {
      getSerializedSize();
      for (int i = 0; i < startTimes_.size(); i++) {
        output.writeMessage(1, startTimes_.get(i));
      }
      if (getDaysOfWeekList().size() > 0) {
        output.writeUInt32NoTag(18);
        output.writeUInt32NoTag(daysOfWeekMemoizedSerializedSize);
      }
      for (int i = 0; i < daysOfWeek_.size(); i++) {
        output.writeEnumNoTag(daysOfWeek_.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 < startTimes_.size(); i++) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, startTimes_.get(i));
      }
      {
        int dataSize = 0;
        for (int i = 0; i < daysOfWeek_.size(); i++) {
          dataSize +=
              com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag(daysOfWeek_.get(i));
        }
        size += dataSize;
        if (!getDaysOfWeekList().isEmpty()) {
          size += 1;
          size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize);
        }
        daysOfWeekMemoizedSerializedSize = dataSize;
      }
      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.AutomatedBackupPolicy.WeeklySchedule)) {
        return super.equals(obj);
      }
      com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule other =
          (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) obj;

      if (!getStartTimesList().equals(other.getStartTimesList())) return false;
      if (!daysOfWeek_.equals(other.daysOfWeek_)) 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 (getStartTimesCount() > 0) {
        hash = (37 * hash) + START_TIMES_FIELD_NUMBER;
        hash = (53 * hash) + getStartTimesList().hashCode();
      }
      if (getDaysOfWeekCount() > 0) {
        hash = (37 * hash) + DAYS_OF_WEEK_FIELD_NUMBER;
        hash = (53 * hash) + daysOfWeek_.hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

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

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

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

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

    public static com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
        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.AutomatedBackupPolicy.WeeklySchedule 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.AutomatedBackupPolicy.WeeklySchedule 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.AutomatedBackupPolicy.WeeklySchedule prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     *
     *
     * <pre>
     * A weekly schedule starts a backup at prescribed start times within a
     * day, for the specified days of the week.
     * The weekly schedule message is flexible and can be used to create many
     * types of schedules. For example, to have a daily backup that starts at
     * 22:00, configure the `start_times` field to have one element "22:00" and
     * the `days_of_week` field to have all seven days of the week.
     * </pre>
     *
     * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule)
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_WeeklySchedule_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_WeeklySchedule_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.class,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder
                    .class);
      }

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

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

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

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

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

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

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

      private void buildPartialRepeatedFields(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule result) {
        if (startTimesBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)) {
            startTimes_ = java.util.Collections.unmodifiableList(startTimes_);
            bitField0_ = (bitField0_ & ~0x00000001);
          }
          result.startTimes_ = startTimes_;
        } else {
          result.startTimes_ = startTimesBuilder_.build();
        }
        if (((bitField0_ & 0x00000002) != 0)) {
          daysOfWeek_ = java.util.Collections.unmodifiableList(daysOfWeek_);
          bitField0_ = (bitField0_ & ~0x00000002);
        }
        result.daysOfWeek_ = daysOfWeek_;
      }

      private void buildPartial0(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule result) {
        int from_bitField0_ = bitField0_;
      }

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

      public Builder mergeFrom(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule other) {
        if (other
            == com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
                .getDefaultInstance()) return this;
        if (startTimesBuilder_ == null) {
          if (!other.startTimes_.isEmpty()) {
            if (startTimes_.isEmpty()) {
              startTimes_ = other.startTimes_;
              bitField0_ = (bitField0_ & ~0x00000001);
            } else {
              ensureStartTimesIsMutable();
              startTimes_.addAll(other.startTimes_);
            }
            onChanged();
          }
        } else {
          if (!other.startTimes_.isEmpty()) {
            if (startTimesBuilder_.isEmpty()) {
              startTimesBuilder_.dispose();
              startTimesBuilder_ = null;
              startTimes_ = other.startTimes_;
              bitField0_ = (bitField0_ & ~0x00000001);
              startTimesBuilder_ =
                  com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders
                      ? getStartTimesFieldBuilder()
                      : null;
            } else {
              startTimesBuilder_.addAllMessages(other.startTimes_);
            }
          }
        }
        if (!other.daysOfWeek_.isEmpty()) {
          if (daysOfWeek_.isEmpty()) {
            daysOfWeek_ = other.daysOfWeek_;
            bitField0_ = (bitField0_ & ~0x00000002);
          } else {
            ensureDaysOfWeekIsMutable();
            daysOfWeek_.addAll(other.daysOfWeek_);
          }
          onChanged();
        }
        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.type.TimeOfDay m =
                      input.readMessage(com.google.type.TimeOfDay.parser(), extensionRegistry);
                  if (startTimesBuilder_ == null) {
                    ensureStartTimesIsMutable();
                    startTimes_.add(m);
                  } else {
                    startTimesBuilder_.addMessage(m);
                  }
                  break;
                } // case 10
              case 16:
                {
                  int tmpRaw = input.readEnum();
                  ensureDaysOfWeekIsMutable();
                  daysOfWeek_.add(tmpRaw);
                  break;
                } // case 16
              case 18:
                {
                  int length = input.readRawVarint32();
                  int oldLimit = input.pushLimit(length);
                  while (input.getBytesUntilLimit() > 0) {
                    int tmpRaw = input.readEnum();
                    ensureDaysOfWeekIsMutable();
                    daysOfWeek_.add(tmpRaw);
                  }
                  input.popLimit(oldLimit);
                  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.type.TimeOfDay> startTimes_ =
          java.util.Collections.emptyList();

      private void ensureStartTimesIsMutable() {
        if (!((bitField0_ & 0x00000001) != 0)) {
          startTimes_ = new java.util.ArrayList<com.google.type.TimeOfDay>(startTimes_);
          bitField0_ |= 0x00000001;
        }
      }

      private com.google.protobuf.RepeatedFieldBuilderV3<
              com.google.type.TimeOfDay,
              com.google.type.TimeOfDay.Builder,
              com.google.type.TimeOfDayOrBuilder>
          startTimesBuilder_;

      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public java.util.List<com.google.type.TimeOfDay> getStartTimesList() {
        if (startTimesBuilder_ == null) {
          return java.util.Collections.unmodifiableList(startTimes_);
        } else {
          return startTimesBuilder_.getMessageList();
        }
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public int getStartTimesCount() {
        if (startTimesBuilder_ == null) {
          return startTimes_.size();
        } else {
          return startTimesBuilder_.getCount();
        }
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public com.google.type.TimeOfDay getStartTimes(int index) {
        if (startTimesBuilder_ == null) {
          return startTimes_.get(index);
        } else {
          return startTimesBuilder_.getMessage(index);
        }
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder setStartTimes(int index, com.google.type.TimeOfDay value) {
        if (startTimesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureStartTimesIsMutable();
          startTimes_.set(index, value);
          onChanged();
        } else {
          startTimesBuilder_.setMessage(index, value);
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder setStartTimes(int index, com.google.type.TimeOfDay.Builder builderForValue) {
        if (startTimesBuilder_ == null) {
          ensureStartTimesIsMutable();
          startTimes_.set(index, builderForValue.build());
          onChanged();
        } else {
          startTimesBuilder_.setMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder addStartTimes(com.google.type.TimeOfDay value) {
        if (startTimesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureStartTimesIsMutable();
          startTimes_.add(value);
          onChanged();
        } else {
          startTimesBuilder_.addMessage(value);
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder addStartTimes(int index, com.google.type.TimeOfDay value) {
        if (startTimesBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          ensureStartTimesIsMutable();
          startTimes_.add(index, value);
          onChanged();
        } else {
          startTimesBuilder_.addMessage(index, value);
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder addStartTimes(com.google.type.TimeOfDay.Builder builderForValue) {
        if (startTimesBuilder_ == null) {
          ensureStartTimesIsMutable();
          startTimes_.add(builderForValue.build());
          onChanged();
        } else {
          startTimesBuilder_.addMessage(builderForValue.build());
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder addStartTimes(int index, com.google.type.TimeOfDay.Builder builderForValue) {
        if (startTimesBuilder_ == null) {
          ensureStartTimesIsMutable();
          startTimes_.add(index, builderForValue.build());
          onChanged();
        } else {
          startTimesBuilder_.addMessage(index, builderForValue.build());
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder addAllStartTimes(
          java.lang.Iterable<? extends com.google.type.TimeOfDay> values) {
        if (startTimesBuilder_ == null) {
          ensureStartTimesIsMutable();
          com.google.protobuf.AbstractMessageLite.Builder.addAll(values, startTimes_);
          onChanged();
        } else {
          startTimesBuilder_.addAllMessages(values);
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder clearStartTimes() {
        if (startTimesBuilder_ == null) {
          startTimes_ = java.util.Collections.emptyList();
          bitField0_ = (bitField0_ & ~0x00000001);
          onChanged();
        } else {
          startTimesBuilder_.clear();
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public Builder removeStartTimes(int index) {
        if (startTimesBuilder_ == null) {
          ensureStartTimesIsMutable();
          startTimes_.remove(index);
          onChanged();
        } else {
          startTimesBuilder_.remove(index);
        }
        return this;
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public com.google.type.TimeOfDay.Builder getStartTimesBuilder(int index) {
        return getStartTimesFieldBuilder().getBuilder(index);
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public com.google.type.TimeOfDayOrBuilder getStartTimesOrBuilder(int index) {
        if (startTimesBuilder_ == null) {
          return startTimes_.get(index);
        } else {
          return startTimesBuilder_.getMessageOrBuilder(index);
        }
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public java.util.List<? extends com.google.type.TimeOfDayOrBuilder>
          getStartTimesOrBuilderList() {
        if (startTimesBuilder_ != null) {
          return startTimesBuilder_.getMessageOrBuilderList();
        } else {
          return java.util.Collections.unmodifiableList(startTimes_);
        }
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public com.google.type.TimeOfDay.Builder addStartTimesBuilder() {
        return getStartTimesFieldBuilder()
            .addBuilder(com.google.type.TimeOfDay.getDefaultInstance());
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public com.google.type.TimeOfDay.Builder addStartTimesBuilder(int index) {
        return getStartTimesFieldBuilder()
            .addBuilder(index, com.google.type.TimeOfDay.getDefaultInstance());
      }
      /**
       *
       *
       * <pre>
       * The times during the day to start a backup. The start times are assumed
       * to be in UTC and to be an exact hour (e.g., 04:00:00).
       * If no start times are provided, a single fixed start time is chosen
       * arbitrarily.
       * </pre>
       *
       * <code>repeated .google.type.TimeOfDay start_times = 1;</code>
       */
      public java.util.List<com.google.type.TimeOfDay.Builder> getStartTimesBuilderList() {
        return getStartTimesFieldBuilder().getBuilderList();
      }

      private com.google.protobuf.RepeatedFieldBuilderV3<
              com.google.type.TimeOfDay,
              com.google.type.TimeOfDay.Builder,
              com.google.type.TimeOfDayOrBuilder>
          getStartTimesFieldBuilder() {
        if (startTimesBuilder_ == null) {
          startTimesBuilder_ =
              new com.google.protobuf.RepeatedFieldBuilderV3<
                  com.google.type.TimeOfDay,
                  com.google.type.TimeOfDay.Builder,
                  com.google.type.TimeOfDayOrBuilder>(
                  startTimes_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean());
          startTimes_ = null;
        }
        return startTimesBuilder_;
      }

      private java.util.List<java.lang.Integer> daysOfWeek_ = java.util.Collections.emptyList();

      private void ensureDaysOfWeekIsMutable() {
        if (!((bitField0_ & 0x00000002) != 0)) {
          daysOfWeek_ = new java.util.ArrayList<java.lang.Integer>(daysOfWeek_);
          bitField0_ |= 0x00000002;
        }
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @return A list containing the daysOfWeek.
       */
      public java.util.List<com.google.type.DayOfWeek> getDaysOfWeekList() {
        return new com.google.protobuf.Internal.ListAdapter<
            java.lang.Integer, com.google.type.DayOfWeek>(daysOfWeek_, daysOfWeek_converter_);
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @return The count of daysOfWeek.
       */
      public int getDaysOfWeekCount() {
        return daysOfWeek_.size();
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param index The index of the element to return.
       * @return The daysOfWeek at the given index.
       */
      public com.google.type.DayOfWeek getDaysOfWeek(int index) {
        return daysOfWeek_converter_.convert(daysOfWeek_.get(index));
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param index The index to set the value at.
       * @param value The daysOfWeek to set.
       * @return This builder for chaining.
       */
      public Builder setDaysOfWeek(int index, com.google.type.DayOfWeek value) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureDaysOfWeekIsMutable();
        daysOfWeek_.set(index, value.getNumber());
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param value The daysOfWeek to add.
       * @return This builder for chaining.
       */
      public Builder addDaysOfWeek(com.google.type.DayOfWeek value) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureDaysOfWeekIsMutable();
        daysOfWeek_.add(value.getNumber());
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param values The daysOfWeek to add.
       * @return This builder for chaining.
       */
      public Builder addAllDaysOfWeek(
          java.lang.Iterable<? extends com.google.type.DayOfWeek> values) {
        ensureDaysOfWeekIsMutable();
        for (com.google.type.DayOfWeek value : values) {
          daysOfWeek_.add(value.getNumber());
        }
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearDaysOfWeek() {
        daysOfWeek_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000002);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @return A list containing the enum numeric values on the wire for daysOfWeek.
       */
      public java.util.List<java.lang.Integer> getDaysOfWeekValueList() {
        return java.util.Collections.unmodifiableList(daysOfWeek_);
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param index The index of the value to return.
       * @return The enum numeric value on the wire of daysOfWeek at the given index.
       */
      public int getDaysOfWeekValue(int index) {
        return daysOfWeek_.get(index);
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param index The index to set the value at.
       * @param value The enum numeric value on the wire for daysOfWeek to set.
       * @return This builder for chaining.
       */
      public Builder setDaysOfWeekValue(int index, int value) {
        ensureDaysOfWeekIsMutable();
        daysOfWeek_.set(index, value);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param value The enum numeric value on the wire for daysOfWeek to add.
       * @return This builder for chaining.
       */
      public Builder addDaysOfWeekValue(int value) {
        ensureDaysOfWeekIsMutable();
        daysOfWeek_.add(value);
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The days of the week to perform a backup.
       * If this field is left empty, the default of every day of the week is
       * used.
       * </pre>
       *
       * <code>repeated .google.type.DayOfWeek days_of_week = 2;</code>
       *
       * @param values The enum numeric values on the wire for daysOfWeek to add.
       * @return This builder for chaining.
       */
      public Builder addAllDaysOfWeekValue(java.lang.Iterable<java.lang.Integer> values) {
        ensureDaysOfWeekIsMutable();
        for (int value : values) {
          daysOfWeek_.add(value);
        }
        onChanged();
        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.AutomatedBackupPolicy.WeeklySchedule)
    }

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

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

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

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

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

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

  public interface TimeBasedRetentionOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     *
     * @return Whether the retentionPeriod field is set.
     */
    boolean hasRetentionPeriod();
    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     *
     * @return The retentionPeriod.
     */
    com.google.protobuf.Duration getRetentionPeriod();
    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     */
    com.google.protobuf.DurationOrBuilder getRetentionPeriodOrBuilder();
  }
  /**
   *
   *
   * <pre>
   * A time based retention policy specifies that all backups within a certain
   * time period should be retained.
   * </pre>
   *
   * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention}
   */
  public static final class TimeBasedRetention extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
      TimeBasedRetentionOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use TimeBasedRetention.newBuilder() to construct.
    private TimeBasedRetention(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private TimeBasedRetention() {}

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

    @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.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_TimeBasedRetention_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.alloydb.v1alpha.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_TimeBasedRetention_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.class,
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder
                  .class);
    }

    public static final int RETENTION_PERIOD_FIELD_NUMBER = 1;
    private com.google.protobuf.Duration retentionPeriod_;
    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     *
     * @return Whether the retentionPeriod field is set.
     */
    @java.lang.Override
    public boolean hasRetentionPeriod() {
      return retentionPeriod_ != null;
    }
    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     *
     * @return The retentionPeriod.
     */
    @java.lang.Override
    public com.google.protobuf.Duration getRetentionPeriod() {
      return retentionPeriod_ == null
          ? com.google.protobuf.Duration.getDefaultInstance()
          : retentionPeriod_;
    }
    /**
     *
     *
     * <pre>
     * The retention period.
     * </pre>
     *
     * <code>.google.protobuf.Duration retention_period = 1;</code>
     */
    @java.lang.Override
    public com.google.protobuf.DurationOrBuilder getRetentionPeriodOrBuilder() {
      return retentionPeriod_ == null
          ? com.google.protobuf.Duration.getDefaultInstance()
          : retentionPeriod_;
    }

    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 (retentionPeriod_ != null) {
        output.writeMessage(1, getRetentionPeriod());
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      if (retentionPeriod_ != null) {
        size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getRetentionPeriod());
      }
      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.AutomatedBackupPolicy.TimeBasedRetention)) {
        return super.equals(obj);
      }
      com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention other =
          (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) obj;

      if (hasRetentionPeriod() != other.hasRetentionPeriod()) return false;
      if (hasRetentionPeriod()) {
        if (!getRetentionPeriod().equals(other.getRetentionPeriod())) 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 (hasRetentionPeriod()) {
        hash = (37 * hash) + RETENTION_PERIOD_FIELD_NUMBER;
        hash = (53 * hash) + getRetentionPeriod().hashCode();
      }
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

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

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

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

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

    public static com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
        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.AutomatedBackupPolicy.TimeBasedRetention
        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.AutomatedBackupPolicy.TimeBasedRetention
        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.AutomatedBackupPolicy.TimeBasedRetention prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     *
     *
     * <pre>
     * A time based retention policy specifies that all backups within a certain
     * time period should be retained.
     * </pre>
     *
     * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_TimeBasedRetention_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_TimeBasedRetention_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.class,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder
                    .class);
      }

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

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

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        retentionPeriod_ = null;
        if (retentionPeriodBuilder_ != null) {
          retentionPeriodBuilder_.dispose();
          retentionPeriodBuilder_ = null;
        }
        return this;
      }

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

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

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

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

      private void buildPartial0(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.retentionPeriod_ =
              retentionPeriodBuilder_ == null ? retentionPeriod_ : retentionPeriodBuilder_.build();
        }
      }

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

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

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

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

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

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

      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other
            instanceof com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) {
          return mergeFrom(
              (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention other) {
        if (other
            == com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
                .getDefaultInstance()) return this;
        if (other.hasRetentionPeriod()) {
          mergeRetentionPeriod(other.getRetentionPeriod());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        onChanged();
        return this;
      }

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

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        if (extensionRegistry == null) {
          throw new java.lang.NullPointerException();
        }
        try {
          boolean done = false;
          while (!done) {
            int tag = input.readTag();
            switch (tag) {
              case 0:
                done = true;
                break;
              case 10:
                {
                  input.readMessage(
                      getRetentionPeriodFieldBuilder().getBuilder(), extensionRegistry);
                  bitField0_ |= 0x00000001;
                  break;
                } // case 10
              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.Duration retentionPeriod_;
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.protobuf.Duration,
              com.google.protobuf.Duration.Builder,
              com.google.protobuf.DurationOrBuilder>
          retentionPeriodBuilder_;
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       *
       * @return Whether the retentionPeriod field is set.
       */
      public boolean hasRetentionPeriod() {
        return ((bitField0_ & 0x00000001) != 0);
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       *
       * @return The retentionPeriod.
       */
      public com.google.protobuf.Duration getRetentionPeriod() {
        if (retentionPeriodBuilder_ == null) {
          return retentionPeriod_ == null
              ? com.google.protobuf.Duration.getDefaultInstance()
              : retentionPeriod_;
        } else {
          return retentionPeriodBuilder_.getMessage();
        }
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public Builder setRetentionPeriod(com.google.protobuf.Duration value) {
        if (retentionPeriodBuilder_ == null) {
          if (value == null) {
            throw new NullPointerException();
          }
          retentionPeriod_ = value;
        } else {
          retentionPeriodBuilder_.setMessage(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public Builder setRetentionPeriod(com.google.protobuf.Duration.Builder builderForValue) {
        if (retentionPeriodBuilder_ == null) {
          retentionPeriod_ = builderForValue.build();
        } else {
          retentionPeriodBuilder_.setMessage(builderForValue.build());
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public Builder mergeRetentionPeriod(com.google.protobuf.Duration value) {
        if (retentionPeriodBuilder_ == null) {
          if (((bitField0_ & 0x00000001) != 0)
              && retentionPeriod_ != null
              && retentionPeriod_ != com.google.protobuf.Duration.getDefaultInstance()) {
            getRetentionPeriodBuilder().mergeFrom(value);
          } else {
            retentionPeriod_ = value;
          }
        } else {
          retentionPeriodBuilder_.mergeFrom(value);
        }
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public Builder clearRetentionPeriod() {
        bitField0_ = (bitField0_ & ~0x00000001);
        retentionPeriod_ = null;
        if (retentionPeriodBuilder_ != null) {
          retentionPeriodBuilder_.dispose();
          retentionPeriodBuilder_ = null;
        }
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public com.google.protobuf.Duration.Builder getRetentionPeriodBuilder() {
        bitField0_ |= 0x00000001;
        onChanged();
        return getRetentionPeriodFieldBuilder().getBuilder();
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      public com.google.protobuf.DurationOrBuilder getRetentionPeriodOrBuilder() {
        if (retentionPeriodBuilder_ != null) {
          return retentionPeriodBuilder_.getMessageOrBuilder();
        } else {
          return retentionPeriod_ == null
              ? com.google.protobuf.Duration.getDefaultInstance()
              : retentionPeriod_;
        }
      }
      /**
       *
       *
       * <pre>
       * The retention period.
       * </pre>
       *
       * <code>.google.protobuf.Duration retention_period = 1;</code>
       */
      private com.google.protobuf.SingleFieldBuilderV3<
              com.google.protobuf.Duration,
              com.google.protobuf.Duration.Builder,
              com.google.protobuf.DurationOrBuilder>
          getRetentionPeriodFieldBuilder() {
        if (retentionPeriodBuilder_ == null) {
          retentionPeriodBuilder_ =
              new com.google.protobuf.SingleFieldBuilderV3<
                  com.google.protobuf.Duration,
                  com.google.protobuf.Duration.Builder,
                  com.google.protobuf.DurationOrBuilder>(
                  getRetentionPeriod(), getParentForChildren(), isClean());
          retentionPeriod_ = null;
        }
        return retentionPeriodBuilder_;
      }

      @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.AutomatedBackupPolicy.TimeBasedRetention)
    }

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

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

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

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

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

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

  public interface QuantityBasedRetentionOrBuilder
      extends
      // @@protoc_insertion_point(interface_extends:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
      com.google.protobuf.MessageOrBuilder {

    /**
     *
     *
     * <pre>
     * The number of backups to retain.
     * </pre>
     *
     * <code>int32 count = 1;</code>
     *
     * @return The count.
     */
    int getCount();
  }
  /**
   *
   *
   * <pre>
   * A quantity based policy specifies that a certain number of the most recent
   * successful backups should be retained.
   * </pre>
   *
   * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention}
   */
  public static final class QuantityBasedRetention extends com.google.protobuf.GeneratedMessageV3
      implements
      // @@protoc_insertion_point(message_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
      QuantityBasedRetentionOrBuilder {
    private static final long serialVersionUID = 0L;
    // Use QuantityBasedRetention.newBuilder() to construct.
    private QuantityBasedRetention(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }

    private QuantityBasedRetention() {}

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

    @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.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_QuantityBasedRetention_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.cloud.alloydb.v1alpha.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_QuantityBasedRetention_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.class,
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.Builder
                  .class);
    }

    public static final int COUNT_FIELD_NUMBER = 1;
    private int count_ = 0;
    /**
     *
     *
     * <pre>
     * The number of backups to retain.
     * </pre>
     *
     * <code>int32 count = 1;</code>
     *
     * @return The count.
     */
    @java.lang.Override
    public int getCount() {
      return count_;
    }

    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 (count_ != 0) {
        output.writeInt32(1, count_);
      }
      getUnknownFields().writeTo(output);
    }

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

      size = 0;
      if (count_ != 0) {
        size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, count_);
      }
      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.AutomatedBackupPolicy.QuantityBasedRetention)) {
        return super.equals(obj);
      }
      com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention other =
          (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention) obj;

      if (getCount() != other.getCount()) 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) + COUNT_FIELD_NUMBER;
      hash = (53 * hash) + getCount();
      hash = (29 * hash) + getUnknownFields().hashCode();
      memoizedHashCode = hash;
      return hash;
    }

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

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

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

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

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

    public static com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
        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.AutomatedBackupPolicy.QuantityBasedRetention
        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.AutomatedBackupPolicy.QuantityBasedRetention
        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.AutomatedBackupPolicy.QuantityBasedRetention prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }

    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     *
     *
     * <pre>
     * A quantity based policy specifies that a certain number of the most recent
     * successful backups should be retained.
     * </pre>
     *
     * Protobuf type {@code
     * google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention}
     */
    public static final class Builder
        extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
        implements
        // @@protoc_insertion_point(builder_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetentionOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_QuantityBasedRetention_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.google.cloud.alloydb.v1alpha.ResourcesProto
            .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_QuantityBasedRetention_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.class,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                    .Builder.class);
      }

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

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

      @java.lang.Override
      public Builder clear() {
        super.clear();
        bitField0_ = 0;
        count_ = 0;
        return this;
      }

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

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

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

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

      private void buildPartial0(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention result) {
        int from_bitField0_ = bitField0_;
        if (((from_bitField0_ & 0x00000001) != 0)) {
          result.count_ = count_;
        }
      }

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

      public Builder mergeFrom(
          com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention other) {
        if (other
            == com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                .getDefaultInstance()) return this;
        if (other.getCount() != 0) {
          setCount(other.getCount());
        }
        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:
                {
                  count_ = input.readInt32();
                  bitField0_ |= 0x00000001;
                  break;
                } // case 8
              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 count_;
      /**
       *
       *
       * <pre>
       * The number of backups to retain.
       * </pre>
       *
       * <code>int32 count = 1;</code>
       *
       * @return The count.
       */
      @java.lang.Override
      public int getCount() {
        return count_;
      }
      /**
       *
       *
       * <pre>
       * The number of backups to retain.
       * </pre>
       *
       * <code>int32 count = 1;</code>
       *
       * @param value The count to set.
       * @return This builder for chaining.
       */
      public Builder setCount(int value) {

        count_ = value;
        bitField0_ |= 0x00000001;
        onChanged();
        return this;
      }
      /**
       *
       *
       * <pre>
       * The number of backups to retain.
       * </pre>
       *
       * <code>int32 count = 1;</code>
       *
       * @return This builder for chaining.
       */
      public Builder clearCount() {
        bitField0_ = (bitField0_ & ~0x00000001);
        count_ = 0;
        onChanged();
        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.AutomatedBackupPolicy.QuantityBasedRetention)
    }

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

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

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

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

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

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

  private int bitField0_;
  private int scheduleCase_ = 0;
  private java.lang.Object schedule_;

  public enum ScheduleCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    WEEKLY_SCHEDULE(2),
    SCHEDULE_NOT_SET(0);
    private final int value;

    private ScheduleCase(int value) {
      this.value = value;
    }
    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static ScheduleCase valueOf(int value) {
      return forNumber(value);
    }

    public static ScheduleCase forNumber(int value) {
      switch (value) {
        case 2:
          return WEEKLY_SCHEDULE;
        case 0:
          return SCHEDULE_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public ScheduleCase getScheduleCase() {
    return ScheduleCase.forNumber(scheduleCase_);
  }

  private int retentionCase_ = 0;
  private java.lang.Object retention_;

  public enum RetentionCase
      implements
          com.google.protobuf.Internal.EnumLite,
          com.google.protobuf.AbstractMessage.InternalOneOfEnum {
    TIME_BASED_RETENTION(4),
    QUANTITY_BASED_RETENTION(5),
    RETENTION_NOT_SET(0);
    private final int value;

    private RetentionCase(int value) {
      this.value = value;
    }
    /**
     * @param value The number of the enum to look for.
     * @return The enum associated with the given number.
     * @deprecated Use {@link #forNumber(int)} instead.
     */
    @java.lang.Deprecated
    public static RetentionCase valueOf(int value) {
      return forNumber(value);
    }

    public static RetentionCase forNumber(int value) {
      switch (value) {
        case 4:
          return TIME_BASED_RETENTION;
        case 5:
          return QUANTITY_BASED_RETENTION;
        case 0:
          return RETENTION_NOT_SET;
        default:
          return null;
      }
    }

    public int getNumber() {
      return this.value;
    }
  };

  public RetentionCase getRetentionCase() {
    return RetentionCase.forNumber(retentionCase_);
  }

  public static final int WEEKLY_SCHEDULE_FIELD_NUMBER = 2;
  /**
   *
   *
   * <pre>
   * Weekly schedule for the Backup.
   * </pre>
   *
   * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
   * </code>
   *
   * @return Whether the weeklySchedule field is set.
   */
  @java.lang.Override
  public boolean hasWeeklySchedule() {
    return scheduleCase_ == 2;
  }
  /**
   *
   *
   * <pre>
   * Weekly schedule for the Backup.
   * </pre>
   *
   * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
   * </code>
   *
   * @return The weeklySchedule.
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule getWeeklySchedule() {
    if (scheduleCase_ == 2) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
        .getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * Weekly schedule for the Backup.
   * </pre>
   *
   * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder
      getWeeklyScheduleOrBuilder() {
    if (scheduleCase_ == 2) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
        .getDefaultInstance();
  }

  public static final int TIME_BASED_RETENTION_FIELD_NUMBER = 4;
  /**
   *
   *
   * <pre>
   * Time-based Backup retention policy.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
   * </code>
   *
   * @return Whether the timeBasedRetention field is set.
   */
  @java.lang.Override
  public boolean hasTimeBasedRetention() {
    return retentionCase_ == 4;
  }
  /**
   *
   *
   * <pre>
   * Time-based Backup retention policy.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
   * </code>
   *
   * @return The timeBasedRetention.
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
      getTimeBasedRetention() {
    if (retentionCase_ == 4) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) retention_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
        .getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * Time-based Backup retention policy.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder
      getTimeBasedRetentionOrBuilder() {
    if (retentionCase_ == 4) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) retention_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
        .getDefaultInstance();
  }

  public static final int QUANTITY_BASED_RETENTION_FIELD_NUMBER = 5;
  /**
   *
   *
   * <pre>
   * Quantity-based Backup retention policy to retain recent backups.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
   * </code>
   *
   * @return Whether the quantityBasedRetention field is set.
   */
  @java.lang.Override
  public boolean hasQuantityBasedRetention() {
    return retentionCase_ == 5;
  }
  /**
   *
   *
   * <pre>
   * Quantity-based Backup retention policy to retain recent backups.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
   * </code>
   *
   * @return The quantityBasedRetention.
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
      getQuantityBasedRetention() {
    if (retentionCase_ == 5) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
          retention_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
        .getDefaultInstance();
  }
  /**
   *
   *
   * <pre>
   * Quantity-based Backup retention policy to retain recent backups.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetentionOrBuilder
      getQuantityBasedRetentionOrBuilder() {
    if (retentionCase_ == 5) {
      return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
          retention_;
    }
    return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
        .getDefaultInstance();
  }

  public static final int ENABLED_FIELD_NUMBER = 1;
  private boolean enabled_ = false;
  /**
   *
   *
   * <pre>
   * Whether automated automated backups are enabled. If not set, defaults to
   * true.
   * </pre>
   *
   * <code>optional bool enabled = 1;</code>
   *
   * @return Whether the enabled field is set.
   */
  @java.lang.Override
  public boolean hasEnabled() {
    return ((bitField0_ & 0x00000001) != 0);
  }
  /**
   *
   *
   * <pre>
   * Whether automated automated backups are enabled. If not set, defaults to
   * true.
   * </pre>
   *
   * <code>optional bool enabled = 1;</code>
   *
   * @return The enabled.
   */
  @java.lang.Override
  public boolean getEnabled() {
    return enabled_;
  }

  public static final int BACKUP_WINDOW_FIELD_NUMBER = 3;
  private com.google.protobuf.Duration backupWindow_;
  /**
   *
   *
   * <pre>
   * The length of the time window during which a backup can be
   * taken. If a backup does not succeed within this time window, it will be
   * canceled and considered failed.
   * The backup window must be at least 5 minutes long. There is no upper bound
   * on the window. If not set, it defaults to 1 hour.
   * </pre>
   *
   * <code>.google.protobuf.Duration backup_window = 3;</code>
   *
   * @return Whether the backupWindow field is set.
   */
  @java.lang.Override
  public boolean hasBackupWindow() {
    return backupWindow_ != null;
  }
  /**
   *
   *
   * <pre>
   * The length of the time window during which a backup can be
   * taken. If a backup does not succeed within this time window, it will be
   * canceled and considered failed.
   * The backup window must be at least 5 minutes long. There is no upper bound
   * on the window. If not set, it defaults to 1 hour.
   * </pre>
   *
   * <code>.google.protobuf.Duration backup_window = 3;</code>
   *
   * @return The backupWindow.
   */
  @java.lang.Override
  public com.google.protobuf.Duration getBackupWindow() {
    return backupWindow_ == null
        ? com.google.protobuf.Duration.getDefaultInstance()
        : backupWindow_;
  }
  /**
   *
   *
   * <pre>
   * The length of the time window during which a backup can be
   * taken. If a backup does not succeed within this time window, it will be
   * canceled and considered failed.
   * The backup window must be at least 5 minutes long. There is no upper bound
   * on the window. If not set, it defaults to 1 hour.
   * </pre>
   *
   * <code>.google.protobuf.Duration backup_window = 3;</code>
   */
  @java.lang.Override
  public com.google.protobuf.DurationOrBuilder getBackupWindowOrBuilder() {
    return backupWindow_ == null
        ? com.google.protobuf.Duration.getDefaultInstance()
        : backupWindow_;
  }

  public static final int ENCRYPTION_CONFIG_FIELD_NUMBER = 8;
  private com.google.cloud.alloydb.v1alpha.EncryptionConfig encryptionConfig_;
  /**
   *
   *
   * <pre>
   * Optional. The encryption config can be specified to encrypt the
   * backups with a customer-managed encryption key (CMEK). When this field is
   * not specified, the backup will then use default encryption scheme to
   * protect the user data.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return Whether the encryptionConfig field is set.
   */
  @java.lang.Override
  public boolean hasEncryptionConfig() {
    return encryptionConfig_ != null;
  }
  /**
   *
   *
   * <pre>
   * Optional. The encryption config can be specified to encrypt the
   * backups with a customer-managed encryption key (CMEK). When this field is
   * not specified, the backup will then use default encryption scheme to
   * protect the user data.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   *
   * @return The encryptionConfig.
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.EncryptionConfig getEncryptionConfig() {
    return encryptionConfig_ == null
        ? com.google.cloud.alloydb.v1alpha.EncryptionConfig.getDefaultInstance()
        : encryptionConfig_;
  }
  /**
   *
   *
   * <pre>
   * Optional. The encryption config can be specified to encrypt the
   * backups with a customer-managed encryption key (CMEK). When this field is
   * not specified, the backup will then use default encryption scheme to
   * protect the user data.
   * </pre>
   *
   * <code>
   * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
   * </code>
   */
  @java.lang.Override
  public com.google.cloud.alloydb.v1alpha.EncryptionConfigOrBuilder getEncryptionConfigOrBuilder() {
    return encryptionConfig_ == null
        ? com.google.cloud.alloydb.v1alpha.EncryptionConfig.getDefaultInstance()
        : encryptionConfig_;
  }

  public static final int LOCATION_FIELD_NUMBER = 6;

  @SuppressWarnings("serial")
  private volatile java.lang.Object location_ = "";
  /**
   *
   *
   * <pre>
   * The location where the backup will be stored. Currently, the only supported
   * option is to store the backup in the same region as the cluster.
   * If empty, defaults to the region of the cluster.
   * </pre>
   *
   * <code>string location = 6;</code>
   *
   * @return The location.
   */
  @java.lang.Override
  public java.lang.String getLocation() {
    java.lang.Object ref = location_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      location_ = s;
      return s;
    }
  }
  /**
   *
   *
   * <pre>
   * The location where the backup will be stored. Currently, the only supported
   * option is to store the backup in the same region as the cluster.
   * If empty, defaults to the region of the cluster.
   * </pre>
   *
   * <code>string location = 6;</code>
   *
   * @return The bytes for location.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getLocationBytes() {
    java.lang.Object ref = location_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b =
          com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
      location_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int LABELS_FIELD_NUMBER = 7;

  private static final class LabelsDefaultEntryHolder {
    static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry =
        com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance(
            com.google.cloud.alloydb.v1alpha.ResourcesProto
                .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_LabelsEntry_descriptor,
            com.google.protobuf.WireFormat.FieldType.STRING,
            "",
            com.google.protobuf.WireFormat.FieldType.STRING,
            "");
  }

  @SuppressWarnings("serial")
  private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

  private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
    if (labels_ == null) {
      return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
    }
    return labels_;
  }

  public int getLabelsCount() {
    return internalGetLabels().getMap().size();
  }
  /**
   *
   *
   * <pre>
   * Labels to apply to backups created using this configuration.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 7;</code>
   */
  @java.lang.Override
  public boolean containsLabels(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    return internalGetLabels().getMap().containsKey(key);
  }
  /** Use {@link #getLabelsMap()} instead. */
  @java.lang.Override
  @java.lang.Deprecated
  public java.util.Map<java.lang.String, java.lang.String> getLabels() {
    return getLabelsMap();
  }
  /**
   *
   *
   * <pre>
   * Labels to apply to backups created using this configuration.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 7;</code>
   */
  @java.lang.Override
  public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
    return internalGetLabels().getMap();
  }
  /**
   *
   *
   * <pre>
   * Labels to apply to backups created using this configuration.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 7;</code>
   */
  @java.lang.Override
  public /* nullable */ java.lang.String getLabelsOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
  /**
   *
   *
   * <pre>
   * Labels to apply to backups created using this configuration.
   * </pre>
   *
   * <code>map&lt;string, string&gt; labels = 7;</code>
   */
  @java.lang.Override
  public java.lang.String getLabelsOrThrow(java.lang.String key) {
    if (key == null) {
      throw new NullPointerException("map key");
    }
    java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().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 {
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeBool(1, enabled_);
    }
    if (scheduleCase_ == 2) {
      output.writeMessage(
          2, (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_);
    }
    if (backupWindow_ != null) {
      output.writeMessage(3, getBackupWindow());
    }
    if (retentionCase_ == 4) {
      output.writeMessage(
          4,
          (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention) retention_);
    }
    if (retentionCase_ == 5) {
      output.writeMessage(
          5,
          (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
              retention_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 6, location_);
    }
    com.google.protobuf.GeneratedMessageV3.serializeStringMapTo(
        output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 7);
    if (encryptionConfig_ != null) {
      output.writeMessage(8, getEncryptionConfig());
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, enabled_);
    }
    if (scheduleCase_ == 2) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              2, (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_);
    }
    if (backupWindow_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getBackupWindow());
    }
    if (retentionCase_ == 4) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              4,
              (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
                  retention_);
    }
    if (retentionCase_ == 5) {
      size +=
          com.google.protobuf.CodedOutputStream.computeMessageSize(
              5,
              (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
                  retention_);
    }
    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(location_)) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, location_);
    }
    for (java.util.Map.Entry<java.lang.String, java.lang.String> entry :
        internalGetLabels().getMap().entrySet()) {
      com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
          LabelsDefaultEntryHolder.defaultEntry
              .newBuilderForType()
              .setKey(entry.getKey())
              .setValue(entry.getValue())
              .build();
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, labels__);
    }
    if (encryptionConfig_ != null) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getEncryptionConfig());
    }
    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.AutomatedBackupPolicy)) {
      return super.equals(obj);
    }
    com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy other =
        (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy) obj;

    if (hasEnabled() != other.hasEnabled()) return false;
    if (hasEnabled()) {
      if (getEnabled() != other.getEnabled()) return false;
    }
    if (hasBackupWindow() != other.hasBackupWindow()) return false;
    if (hasBackupWindow()) {
      if (!getBackupWindow().equals(other.getBackupWindow())) return false;
    }
    if (hasEncryptionConfig() != other.hasEncryptionConfig()) return false;
    if (hasEncryptionConfig()) {
      if (!getEncryptionConfig().equals(other.getEncryptionConfig())) return false;
    }
    if (!getLocation().equals(other.getLocation())) return false;
    if (!internalGetLabels().equals(other.internalGetLabels())) return false;
    if (!getScheduleCase().equals(other.getScheduleCase())) return false;
    switch (scheduleCase_) {
      case 2:
        if (!getWeeklySchedule().equals(other.getWeeklySchedule())) return false;
        break;
      case 0:
      default:
    }
    if (!getRetentionCase().equals(other.getRetentionCase())) return false;
    switch (retentionCase_) {
      case 4:
        if (!getTimeBasedRetention().equals(other.getTimeBasedRetention())) return false;
        break;
      case 5:
        if (!getQuantityBasedRetention().equals(other.getQuantityBasedRetention())) return false;
        break;
      case 0:
      default:
    }
    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 (hasEnabled()) {
      hash = (37 * hash) + ENABLED_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnabled());
    }
    if (hasBackupWindow()) {
      hash = (37 * hash) + BACKUP_WINDOW_FIELD_NUMBER;
      hash = (53 * hash) + getBackupWindow().hashCode();
    }
    if (hasEncryptionConfig()) {
      hash = (37 * hash) + ENCRYPTION_CONFIG_FIELD_NUMBER;
      hash = (53 * hash) + getEncryptionConfig().hashCode();
    }
    hash = (37 * hash) + LOCATION_FIELD_NUMBER;
    hash = (53 * hash) + getLocation().hashCode();
    if (!internalGetLabels().getMap().isEmpty()) {
      hash = (37 * hash) + LABELS_FIELD_NUMBER;
      hash = (53 * hash) + internalGetLabels().hashCode();
    }
    switch (scheduleCase_) {
      case 2:
        hash = (37 * hash) + WEEKLY_SCHEDULE_FIELD_NUMBER;
        hash = (53 * hash) + getWeeklySchedule().hashCode();
        break;
      case 0:
      default:
    }
    switch (retentionCase_) {
      case 4:
        hash = (37 * hash) + TIME_BASED_RETENTION_FIELD_NUMBER;
        hash = (53 * hash) + getTimeBasedRetention().hashCode();
        break;
      case 5:
        hash = (37 * hash) + QUANTITY_BASED_RETENTION_FIELD_NUMBER;
        hash = (53 * hash) + getQuantityBasedRetention().hashCode();
        break;
      case 0:
      default:
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

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

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

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

  public static com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy 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.AutomatedBackupPolicy 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.AutomatedBackupPolicy 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.AutomatedBackupPolicy 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 describing the user-specified automated backup policy.
   * All fields in the automated backup policy are optional. Defaults for each
   * field are provided if they are not set.
   * </pre>
   *
   * Protobuf type {@code google.cloud.alloydb.v1alpha.AutomatedBackupPolicy}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.cloud.alloydb.v1alpha.AutomatedBackupPolicy)
      com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicyOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.cloud.alloydb.v1alpha.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_descriptor;
    }

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

    @SuppressWarnings({"rawtypes"})
    protected com.google.protobuf.MapField internalGetMutableMapField(int number) {
      switch (number) {
        case 7:
          return internalGetMutableLabels();
        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.ResourcesProto
          .internal_static_google_cloud_alloydb_v1alpha_AutomatedBackupPolicy_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.class,
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.Builder.class);
    }

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

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

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      if (weeklyScheduleBuilder_ != null) {
        weeklyScheduleBuilder_.clear();
      }
      if (timeBasedRetentionBuilder_ != null) {
        timeBasedRetentionBuilder_.clear();
      }
      if (quantityBasedRetentionBuilder_ != null) {
        quantityBasedRetentionBuilder_.clear();
      }
      enabled_ = false;
      backupWindow_ = null;
      if (backupWindowBuilder_ != null) {
        backupWindowBuilder_.dispose();
        backupWindowBuilder_ = null;
      }
      encryptionConfig_ = null;
      if (encryptionConfigBuilder_ != null) {
        encryptionConfigBuilder_.dispose();
        encryptionConfigBuilder_ = null;
      }
      location_ = "";
      internalGetMutableLabels().clear();
      scheduleCase_ = 0;
      schedule_ = null;
      retentionCase_ = 0;
      retention_ = null;
      return this;
    }

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

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

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

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

    private void buildPartial0(com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy result) {
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000008) != 0)) {
        result.enabled_ = enabled_;
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000010) != 0)) {
        result.backupWindow_ =
            backupWindowBuilder_ == null ? backupWindow_ : backupWindowBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000020) != 0)) {
        result.encryptionConfig_ =
            encryptionConfigBuilder_ == null ? encryptionConfig_ : encryptionConfigBuilder_.build();
      }
      if (((from_bitField0_ & 0x00000040) != 0)) {
        result.location_ = location_;
      }
      if (((from_bitField0_ & 0x00000080) != 0)) {
        result.labels_ = internalGetLabels();
        result.labels_.makeImmutable();
      }
      result.bitField0_ |= to_bitField0_;
    }

    private void buildPartialOneofs(com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy result) {
      result.scheduleCase_ = scheduleCase_;
      result.schedule_ = this.schedule_;
      if (scheduleCase_ == 2 && weeklyScheduleBuilder_ != null) {
        result.schedule_ = weeklyScheduleBuilder_.build();
      }
      result.retentionCase_ = retentionCase_;
      result.retention_ = this.retention_;
      if (retentionCase_ == 4 && timeBasedRetentionBuilder_ != null) {
        result.retention_ = timeBasedRetentionBuilder_.build();
      }
      if (retentionCase_ == 5 && quantityBasedRetentionBuilder_ != null) {
        result.retention_ = quantityBasedRetentionBuilder_.build();
      }
    }

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

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

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

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

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

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

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

    public Builder mergeFrom(com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy other) {
      if (other == com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.getDefaultInstance())
        return this;
      if (other.hasEnabled()) {
        setEnabled(other.getEnabled());
      }
      if (other.hasBackupWindow()) {
        mergeBackupWindow(other.getBackupWindow());
      }
      if (other.hasEncryptionConfig()) {
        mergeEncryptionConfig(other.getEncryptionConfig());
      }
      if (!other.getLocation().isEmpty()) {
        location_ = other.location_;
        bitField0_ |= 0x00000040;
        onChanged();
      }
      internalGetMutableLabels().mergeFrom(other.internalGetLabels());
      bitField0_ |= 0x00000080;
      switch (other.getScheduleCase()) {
        case WEEKLY_SCHEDULE:
          {
            mergeWeeklySchedule(other.getWeeklySchedule());
            break;
          }
        case SCHEDULE_NOT_SET:
          {
            break;
          }
      }
      switch (other.getRetentionCase()) {
        case TIME_BASED_RETENTION:
          {
            mergeTimeBasedRetention(other.getTimeBasedRetention());
            break;
          }
        case QUANTITY_BASED_RETENTION:
          {
            mergeQuantityBasedRetention(other.getQuantityBasedRetention());
            break;
          }
        case RETENTION_NOT_SET:
          {
            break;
          }
      }
      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:
              {
                enabled_ = input.readBool();
                bitField0_ |= 0x00000008;
                break;
              } // case 8
            case 18:
              {
                input.readMessage(getWeeklyScheduleFieldBuilder().getBuilder(), extensionRegistry);
                scheduleCase_ = 2;
                break;
              } // case 18
            case 26:
              {
                input.readMessage(getBackupWindowFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000010;
                break;
              } // case 26
            case 34:
              {
                input.readMessage(
                    getTimeBasedRetentionFieldBuilder().getBuilder(), extensionRegistry);
                retentionCase_ = 4;
                break;
              } // case 34
            case 42:
              {
                input.readMessage(
                    getQuantityBasedRetentionFieldBuilder().getBuilder(), extensionRegistry);
                retentionCase_ = 5;
                break;
              } // case 42
            case 50:
              {
                location_ = input.readStringRequireUtf8();
                bitField0_ |= 0x00000040;
                break;
              } // case 50
            case 58:
              {
                com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ =
                    input.readMessage(
                        LabelsDefaultEntryHolder.defaultEntry.getParserForType(),
                        extensionRegistry);
                internalGetMutableLabels()
                    .getMutableMap()
                    .put(labels__.getKey(), labels__.getValue());
                bitField0_ |= 0x00000080;
                break;
              } // case 58
            case 66:
              {
                input.readMessage(
                    getEncryptionConfigFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000020;
                break;
              } // case 66
            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 scheduleCase_ = 0;
    private java.lang.Object schedule_;

    public ScheduleCase getScheduleCase() {
      return ScheduleCase.forNumber(scheduleCase_);
    }

    public Builder clearSchedule() {
      scheduleCase_ = 0;
      schedule_ = null;
      onChanged();
      return this;
    }

    private int retentionCase_ = 0;
    private java.lang.Object retention_;

    public RetentionCase getRetentionCase() {
      return RetentionCase.forNumber(retentionCase_);
    }

    public Builder clearRetention() {
      retentionCase_ = 0;
      retention_ = null;
      onChanged();
      return this;
    }

    private int bitField0_;

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder>
        weeklyScheduleBuilder_;
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     *
     * @return Whether the weeklySchedule field is set.
     */
    @java.lang.Override
    public boolean hasWeeklySchedule() {
      return scheduleCase_ == 2;
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     *
     * @return The weeklySchedule.
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
        getWeeklySchedule() {
      if (weeklyScheduleBuilder_ == null) {
        if (scheduleCase_ == 2) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
            .getDefaultInstance();
      } else {
        if (scheduleCase_ == 2) {
          return weeklyScheduleBuilder_.getMessage();
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    public Builder setWeeklySchedule(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule value) {
      if (weeklyScheduleBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        schedule_ = value;
        onChanged();
      } else {
        weeklyScheduleBuilder_.setMessage(value);
      }
      scheduleCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    public Builder setWeeklySchedule(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder
            builderForValue) {
      if (weeklyScheduleBuilder_ == null) {
        schedule_ = builderForValue.build();
        onChanged();
      } else {
        weeklyScheduleBuilder_.setMessage(builderForValue.build());
      }
      scheduleCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    public Builder mergeWeeklySchedule(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule value) {
      if (weeklyScheduleBuilder_ == null) {
        if (scheduleCase_ == 2
            && schedule_
                != com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
                    .getDefaultInstance()) {
          schedule_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.newBuilder(
                      (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule)
                          schedule_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          schedule_ = value;
        }
        onChanged();
      } else {
        if (scheduleCase_ == 2) {
          weeklyScheduleBuilder_.mergeFrom(value);
        } else {
          weeklyScheduleBuilder_.setMessage(value);
        }
      }
      scheduleCase_ = 2;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    public Builder clearWeeklySchedule() {
      if (weeklyScheduleBuilder_ == null) {
        if (scheduleCase_ == 2) {
          scheduleCase_ = 0;
          schedule_ = null;
          onChanged();
        }
      } else {
        if (scheduleCase_ == 2) {
          scheduleCase_ = 0;
          schedule_ = null;
        }
        weeklyScheduleBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder
        getWeeklyScheduleBuilder() {
      return getWeeklyScheduleFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder
        getWeeklyScheduleOrBuilder() {
      if ((scheduleCase_ == 2) && (weeklyScheduleBuilder_ != null)) {
        return weeklyScheduleBuilder_.getMessageOrBuilder();
      } else {
        if (scheduleCase_ == 2) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Weekly schedule for the Backup.
     * </pre>
     *
     * <code>.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule weekly_schedule = 2;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder>
        getWeeklyScheduleFieldBuilder() {
      if (weeklyScheduleBuilder_ == null) {
        if (!(scheduleCase_ == 2)) {
          schedule_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule
                  .getDefaultInstance();
        }
        weeklyScheduleBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule.Builder,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklyScheduleOrBuilder>(
                (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.WeeklySchedule) schedule_,
                getParentForChildren(),
                isClean());
        schedule_ = null;
      }
      scheduleCase_ = 2;
      onChanged();
      return weeklyScheduleBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder>
        timeBasedRetentionBuilder_;
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     *
     * @return Whether the timeBasedRetention field is set.
     */
    @java.lang.Override
    public boolean hasTimeBasedRetention() {
      return retentionCase_ == 4;
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     *
     * @return The timeBasedRetention.
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
        getTimeBasedRetention() {
      if (timeBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 4) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
              retention_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
            .getDefaultInstance();
      } else {
        if (retentionCase_ == 4) {
          return timeBasedRetentionBuilder_.getMessage();
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    public Builder setTimeBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention value) {
      if (timeBasedRetentionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        retention_ = value;
        onChanged();
      } else {
        timeBasedRetentionBuilder_.setMessage(value);
      }
      retentionCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    public Builder setTimeBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder
            builderForValue) {
      if (timeBasedRetentionBuilder_ == null) {
        retention_ = builderForValue.build();
        onChanged();
      } else {
        timeBasedRetentionBuilder_.setMessage(builderForValue.build());
      }
      retentionCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    public Builder mergeTimeBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention value) {
      if (timeBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 4
            && retention_
                != com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
                    .getDefaultInstance()) {
          retention_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.newBuilder(
                      (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
                          retention_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          retention_ = value;
        }
        onChanged();
      } else {
        if (retentionCase_ == 4) {
          timeBasedRetentionBuilder_.mergeFrom(value);
        } else {
          timeBasedRetentionBuilder_.setMessage(value);
        }
      }
      retentionCase_ = 4;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    public Builder clearTimeBasedRetention() {
      if (timeBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 4) {
          retentionCase_ = 0;
          retention_ = null;
          onChanged();
        }
      } else {
        if (retentionCase_ == 4) {
          retentionCase_ = 0;
          retention_ = null;
        }
        timeBasedRetentionBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder
        getTimeBasedRetentionBuilder() {
      return getTimeBasedRetentionFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder
        getTimeBasedRetentionOrBuilder() {
      if ((retentionCase_ == 4) && (timeBasedRetentionBuilder_ != null)) {
        return timeBasedRetentionBuilder_.getMessageOrBuilder();
      } else {
        if (retentionCase_ == 4) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
              retention_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Time-based Backup retention policy.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention time_based_retention = 4;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder>
        getTimeBasedRetentionFieldBuilder() {
      if (timeBasedRetentionBuilder_ == null) {
        if (!(retentionCase_ == 4)) {
          retention_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention
                  .getDefaultInstance();
        }
        timeBasedRetentionBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention.Builder,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetentionOrBuilder>(
                (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.TimeBasedRetention)
                    retention_,
                getParentForChildren(),
                isClean());
        retention_ = null;
      }
      retentionCase_ = 4;
      onChanged();
      return timeBasedRetentionBuilder_;
    }

    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetentionOrBuilder>
        quantityBasedRetentionBuilder_;
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     *
     * @return Whether the quantityBasedRetention field is set.
     */
    @java.lang.Override
    public boolean hasQuantityBasedRetention() {
      return retentionCase_ == 5;
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     *
     * @return The quantityBasedRetention.
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
        getQuantityBasedRetention() {
      if (quantityBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 5) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
              retention_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
            .getDefaultInstance();
      } else {
        if (retentionCase_ == 5) {
          return quantityBasedRetentionBuilder_.getMessage();
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    public Builder setQuantityBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention value) {
      if (quantityBasedRetentionBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        retention_ = value;
        onChanged();
      } else {
        quantityBasedRetentionBuilder_.setMessage(value);
      }
      retentionCase_ = 5;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    public Builder setQuantityBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.Builder
            builderForValue) {
      if (quantityBasedRetentionBuilder_ == null) {
        retention_ = builderForValue.build();
        onChanged();
      } else {
        quantityBasedRetentionBuilder_.setMessage(builderForValue.build());
      }
      retentionCase_ = 5;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    public Builder mergeQuantityBasedRetention(
        com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention value) {
      if (quantityBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 5
            && retention_
                != com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                    .getDefaultInstance()) {
          retention_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                  .newBuilder(
                      (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy
                              .QuantityBasedRetention)
                          retention_)
                  .mergeFrom(value)
                  .buildPartial();
        } else {
          retention_ = value;
        }
        onChanged();
      } else {
        if (retentionCase_ == 5) {
          quantityBasedRetentionBuilder_.mergeFrom(value);
        } else {
          quantityBasedRetentionBuilder_.setMessage(value);
        }
      }
      retentionCase_ = 5;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    public Builder clearQuantityBasedRetention() {
      if (quantityBasedRetentionBuilder_ == null) {
        if (retentionCase_ == 5) {
          retentionCase_ = 0;
          retention_ = null;
          onChanged();
        }
      } else {
        if (retentionCase_ == 5) {
          retentionCase_ = 0;
          retention_ = null;
        }
        quantityBasedRetentionBuilder_.clear();
      }
      return this;
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.Builder
        getQuantityBasedRetentionBuilder() {
      return getQuantityBasedRetentionFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    @java.lang.Override
    public com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetentionOrBuilder
        getQuantityBasedRetentionOrBuilder() {
      if ((retentionCase_ == 5) && (quantityBasedRetentionBuilder_ != null)) {
        return quantityBasedRetentionBuilder_.getMessageOrBuilder();
      } else {
        if (retentionCase_ == 5) {
          return (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
              retention_;
        }
        return com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
            .getDefaultInstance();
      }
    }
    /**
     *
     *
     * <pre>
     * Quantity-based Backup retention policy to retain recent backups.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention quantity_based_retention = 5;
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention.Builder,
            com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetentionOrBuilder>
        getQuantityBasedRetentionFieldBuilder() {
      if (quantityBasedRetentionBuilder_ == null) {
        if (!(retentionCase_ == 5)) {
          retention_ =
              com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                  .getDefaultInstance();
        }
        quantityBasedRetentionBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention
                    .Builder,
                com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy
                    .QuantityBasedRetentionOrBuilder>(
                (com.google.cloud.alloydb.v1alpha.AutomatedBackupPolicy.QuantityBasedRetention)
                    retention_,
                getParentForChildren(),
                isClean());
        retention_ = null;
      }
      retentionCase_ = 5;
      onChanged();
      return quantityBasedRetentionBuilder_;
    }

    private boolean enabled_;
    /**
     *
     *
     * <pre>
     * Whether automated automated backups are enabled. If not set, defaults to
     * true.
     * </pre>
     *
     * <code>optional bool enabled = 1;</code>
     *
     * @return Whether the enabled field is set.
     */
    @java.lang.Override
    public boolean hasEnabled() {
      return ((bitField0_ & 0x00000008) != 0);
    }
    /**
     *
     *
     * <pre>
     * Whether automated automated backups are enabled. If not set, defaults to
     * true.
     * </pre>
     *
     * <code>optional bool enabled = 1;</code>
     *
     * @return The enabled.
     */
    @java.lang.Override
    public boolean getEnabled() {
      return enabled_;
    }
    /**
     *
     *
     * <pre>
     * Whether automated automated backups are enabled. If not set, defaults to
     * true.
     * </pre>
     *
     * <code>optional bool enabled = 1;</code>
     *
     * @param value The enabled to set.
     * @return This builder for chaining.
     */
    public Builder setEnabled(boolean value) {

      enabled_ = value;
      bitField0_ |= 0x00000008;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Whether automated automated backups are enabled. If not set, defaults to
     * true.
     * </pre>
     *
     * <code>optional bool enabled = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearEnabled() {
      bitField0_ = (bitField0_ & ~0x00000008);
      enabled_ = false;
      onChanged();
      return this;
    }

    private com.google.protobuf.Duration backupWindow_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Duration,
            com.google.protobuf.Duration.Builder,
            com.google.protobuf.DurationOrBuilder>
        backupWindowBuilder_;
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     *
     * @return Whether the backupWindow field is set.
     */
    public boolean hasBackupWindow() {
      return ((bitField0_ & 0x00000010) != 0);
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     *
     * @return The backupWindow.
     */
    public com.google.protobuf.Duration getBackupWindow() {
      if (backupWindowBuilder_ == null) {
        return backupWindow_ == null
            ? com.google.protobuf.Duration.getDefaultInstance()
            : backupWindow_;
      } else {
        return backupWindowBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public Builder setBackupWindow(com.google.protobuf.Duration value) {
      if (backupWindowBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        backupWindow_ = value;
      } else {
        backupWindowBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public Builder setBackupWindow(com.google.protobuf.Duration.Builder builderForValue) {
      if (backupWindowBuilder_ == null) {
        backupWindow_ = builderForValue.build();
      } else {
        backupWindowBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public Builder mergeBackupWindow(com.google.protobuf.Duration value) {
      if (backupWindowBuilder_ == null) {
        if (((bitField0_ & 0x00000010) != 0)
            && backupWindow_ != null
            && backupWindow_ != com.google.protobuf.Duration.getDefaultInstance()) {
          getBackupWindowBuilder().mergeFrom(value);
        } else {
          backupWindow_ = value;
        }
      } else {
        backupWindowBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000010;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public Builder clearBackupWindow() {
      bitField0_ = (bitField0_ & ~0x00000010);
      backupWindow_ = null;
      if (backupWindowBuilder_ != null) {
        backupWindowBuilder_.dispose();
        backupWindowBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public com.google.protobuf.Duration.Builder getBackupWindowBuilder() {
      bitField0_ |= 0x00000010;
      onChanged();
      return getBackupWindowFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    public com.google.protobuf.DurationOrBuilder getBackupWindowOrBuilder() {
      if (backupWindowBuilder_ != null) {
        return backupWindowBuilder_.getMessageOrBuilder();
      } else {
        return backupWindow_ == null
            ? com.google.protobuf.Duration.getDefaultInstance()
            : backupWindow_;
      }
    }
    /**
     *
     *
     * <pre>
     * The length of the time window during which a backup can be
     * taken. If a backup does not succeed within this time window, it will be
     * canceled and considered failed.
     * The backup window must be at least 5 minutes long. There is no upper bound
     * on the window. If not set, it defaults to 1 hour.
     * </pre>
     *
     * <code>.google.protobuf.Duration backup_window = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Duration,
            com.google.protobuf.Duration.Builder,
            com.google.protobuf.DurationOrBuilder>
        getBackupWindowFieldBuilder() {
      if (backupWindowBuilder_ == null) {
        backupWindowBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.protobuf.Duration,
                com.google.protobuf.Duration.Builder,
                com.google.protobuf.DurationOrBuilder>(
                getBackupWindow(), getParentForChildren(), isClean());
        backupWindow_ = null;
      }
      return backupWindowBuilder_;
    }

    private com.google.cloud.alloydb.v1alpha.EncryptionConfig encryptionConfig_;
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.EncryptionConfig,
            com.google.cloud.alloydb.v1alpha.EncryptionConfig.Builder,
            com.google.cloud.alloydb.v1alpha.EncryptionConfigOrBuilder>
        encryptionConfigBuilder_;
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return Whether the encryptionConfig field is set.
     */
    public boolean hasEncryptionConfig() {
      return ((bitField0_ & 0x00000020) != 0);
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     *
     * @return The encryptionConfig.
     */
    public com.google.cloud.alloydb.v1alpha.EncryptionConfig getEncryptionConfig() {
      if (encryptionConfigBuilder_ == null) {
        return encryptionConfig_ == null
            ? com.google.cloud.alloydb.v1alpha.EncryptionConfig.getDefaultInstance()
            : encryptionConfig_;
      } else {
        return encryptionConfigBuilder_.getMessage();
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setEncryptionConfig(com.google.cloud.alloydb.v1alpha.EncryptionConfig value) {
      if (encryptionConfigBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        encryptionConfig_ = value;
      } else {
        encryptionConfigBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder setEncryptionConfig(
        com.google.cloud.alloydb.v1alpha.EncryptionConfig.Builder builderForValue) {
      if (encryptionConfigBuilder_ == null) {
        encryptionConfig_ = builderForValue.build();
      } else {
        encryptionConfigBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder mergeEncryptionConfig(com.google.cloud.alloydb.v1alpha.EncryptionConfig value) {
      if (encryptionConfigBuilder_ == null) {
        if (((bitField0_ & 0x00000020) != 0)
            && encryptionConfig_ != null
            && encryptionConfig_
                != com.google.cloud.alloydb.v1alpha.EncryptionConfig.getDefaultInstance()) {
          getEncryptionConfigBuilder().mergeFrom(value);
        } else {
          encryptionConfig_ = value;
        }
      } else {
        encryptionConfigBuilder_.mergeFrom(value);
      }
      bitField0_ |= 0x00000020;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public Builder clearEncryptionConfig() {
      bitField0_ = (bitField0_ & ~0x00000020);
      encryptionConfig_ = null;
      if (encryptionConfigBuilder_ != null) {
        encryptionConfigBuilder_.dispose();
        encryptionConfigBuilder_ = null;
      }
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.cloud.alloydb.v1alpha.EncryptionConfig.Builder getEncryptionConfigBuilder() {
      bitField0_ |= 0x00000020;
      onChanged();
      return getEncryptionConfigFieldBuilder().getBuilder();
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    public com.google.cloud.alloydb.v1alpha.EncryptionConfigOrBuilder
        getEncryptionConfigOrBuilder() {
      if (encryptionConfigBuilder_ != null) {
        return encryptionConfigBuilder_.getMessageOrBuilder();
      } else {
        return encryptionConfig_ == null
            ? com.google.cloud.alloydb.v1alpha.EncryptionConfig.getDefaultInstance()
            : encryptionConfig_;
      }
    }
    /**
     *
     *
     * <pre>
     * Optional. The encryption config can be specified to encrypt the
     * backups with a customer-managed encryption key (CMEK). When this field is
     * not specified, the backup will then use default encryption scheme to
     * protect the user data.
     * </pre>
     *
     * <code>
     * .google.cloud.alloydb.v1alpha.EncryptionConfig encryption_config = 8 [(.google.api.field_behavior) = OPTIONAL];
     * </code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
            com.google.cloud.alloydb.v1alpha.EncryptionConfig,
            com.google.cloud.alloydb.v1alpha.EncryptionConfig.Builder,
            com.google.cloud.alloydb.v1alpha.EncryptionConfigOrBuilder>
        getEncryptionConfigFieldBuilder() {
      if (encryptionConfigBuilder_ == null) {
        encryptionConfigBuilder_ =
            new com.google.protobuf.SingleFieldBuilderV3<
                com.google.cloud.alloydb.v1alpha.EncryptionConfig,
                com.google.cloud.alloydb.v1alpha.EncryptionConfig.Builder,
                com.google.cloud.alloydb.v1alpha.EncryptionConfigOrBuilder>(
                getEncryptionConfig(), getParentForChildren(), isClean());
        encryptionConfig_ = null;
      }
      return encryptionConfigBuilder_;
    }

    private java.lang.Object location_ = "";
    /**
     *
     *
     * <pre>
     * The location where the backup will be stored. Currently, the only supported
     * option is to store the backup in the same region as the cluster.
     * If empty, defaults to the region of the cluster.
     * </pre>
     *
     * <code>string location = 6;</code>
     *
     * @return The location.
     */
    public java.lang.String getLocation() {
      java.lang.Object ref = location_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        location_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The location where the backup will be stored. Currently, the only supported
     * option is to store the backup in the same region as the cluster.
     * If empty, defaults to the region of the cluster.
     * </pre>
     *
     * <code>string location = 6;</code>
     *
     * @return The bytes for location.
     */
    public com.google.protobuf.ByteString getLocationBytes() {
      java.lang.Object ref = location_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b =
            com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
        location_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     *
     *
     * <pre>
     * The location where the backup will be stored. Currently, the only supported
     * option is to store the backup in the same region as the cluster.
     * If empty, defaults to the region of the cluster.
     * </pre>
     *
     * <code>string location = 6;</code>
     *
     * @param value The location to set.
     * @return This builder for chaining.
     */
    public Builder setLocation(java.lang.String value) {
      if (value == null) {
        throw new NullPointerException();
      }
      location_ = value;
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location where the backup will be stored. Currently, the only supported
     * option is to store the backup in the same region as the cluster.
     * If empty, defaults to the region of the cluster.
     * </pre>
     *
     * <code>string location = 6;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearLocation() {
      location_ = getDefaultInstance().getLocation();
      bitField0_ = (bitField0_ & ~0x00000040);
      onChanged();
      return this;
    }
    /**
     *
     *
     * <pre>
     * The location where the backup will be stored. Currently, the only supported
     * option is to store the backup in the same region as the cluster.
     * If empty, defaults to the region of the cluster.
     * </pre>
     *
     * <code>string location = 6;</code>
     *
     * @param value The bytes for location to set.
     * @return This builder for chaining.
     */
    public Builder setLocationBytes(com.google.protobuf.ByteString value) {
      if (value == null) {
        throw new NullPointerException();
      }
      checkByteStringIsUtf8(value);
      location_ = value;
      bitField0_ |= 0x00000040;
      onChanged();
      return this;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_;

    private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() {
      if (labels_ == null) {
        return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      return labels_;
    }

    private com.google.protobuf.MapField<java.lang.String, java.lang.String>
        internalGetMutableLabels() {
      if (labels_ == null) {
        labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry);
      }
      if (!labels_.isMutable()) {
        labels_ = labels_.copy();
      }
      bitField0_ |= 0x00000080;
      onChanged();
      return labels_;
    }

    public int getLabelsCount() {
      return internalGetLabels().getMap().size();
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    @java.lang.Override
    public boolean containsLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      return internalGetLabels().getMap().containsKey(key);
    }
    /** Use {@link #getLabelsMap()} instead. */
    @java.lang.Override
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getLabels() {
      return getLabelsMap();
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    @java.lang.Override
    public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() {
      return internalGetLabels().getMap();
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    @java.lang.Override
    public /* nullable */ java.lang.String getLabelsOrDefault(
        java.lang.String key,
        /* nullable */
        java.lang.String defaultValue) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      return map.containsKey(key) ? map.get(key) : defaultValue;
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    @java.lang.Override
    public java.lang.String getLabelsOrThrow(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap();
      if (!map.containsKey(key)) {
        throw new java.lang.IllegalArgumentException();
      }
      return map.get(key);
    }

    public Builder clearLabels() {
      bitField0_ = (bitField0_ & ~0x00000080);
      internalGetMutableLabels().getMutableMap().clear();
      return this;
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    public Builder removeLabels(java.lang.String key) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      internalGetMutableLabels().getMutableMap().remove(key);
      return this;
    }
    /** Use alternate mutation accessors instead. */
    @java.lang.Deprecated
    public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() {
      bitField0_ |= 0x00000080;
      return internalGetMutableLabels().getMutableMap();
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    public Builder putLabels(java.lang.String key, java.lang.String value) {
      if (key == null) {
        throw new NullPointerException("map key");
      }
      if (value == null) {
        throw new NullPointerException("map value");
      }
      internalGetMutableLabels().getMutableMap().put(key, value);
      bitField0_ |= 0x00000080;
      return this;
    }
    /**
     *
     *
     * <pre>
     * Labels to apply to backups created using this configuration.
     * </pre>
     *
     * <code>map&lt;string, string&gt; labels = 7;</code>
     */
    public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) {
      internalGetMutableLabels().getMutableMap().putAll(values);
      bitField0_ |= 0x00000080;
      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.AutomatedBackupPolicy)
  }

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

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

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

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

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

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