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

package com.google.apps.card.v1;

/**
 *
 *
 * <pre>
 * Represent an expand and collapse control.
 *
 * [Google Workspace add-ons and Chat
 * apps](https://developers.google.com/workspace/extend):
 * </pre>
 *
 * Protobuf type {@code google.apps.card.v1.CollapseControl}
 */
@com.google.protobuf.Generated
public final class CollapseControl extends com.google.protobuf.GeneratedMessage
    implements
    // @@protoc_insertion_point(message_implements:google.apps.card.v1.CollapseControl)
    CollapseControlOrBuilder {
  private static final long serialVersionUID = 0L;

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

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

  private CollapseControl() {
    horizontalAlignment_ = 0;
  }

  public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
    return com.google.apps.card.v1.CardProto
        .internal_static_google_apps_card_v1_CollapseControl_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.google.apps.card.v1.CardProto
        .internal_static_google_apps_card_v1_CollapseControl_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.google.apps.card.v1.CollapseControl.class,
            com.google.apps.card.v1.CollapseControl.Builder.class);
  }

  private int bitField0_;
  public static final int HORIZONTAL_ALIGNMENT_FIELD_NUMBER = 1;
  private int horizontalAlignment_ = 0;

  /**
   *
   *
   * <pre>
   * The horizontal alignment of the expand and collapse button.
   * </pre>
   *
   * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
   *
   * @return The enum numeric value on the wire for horizontalAlignment.
   */
  @java.lang.Override
  public int getHorizontalAlignmentValue() {
    return horizontalAlignment_;
  }

  /**
   *
   *
   * <pre>
   * The horizontal alignment of the expand and collapse button.
   * </pre>
   *
   * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
   *
   * @return The horizontalAlignment.
   */
  @java.lang.Override
  public com.google.apps.card.v1.Widget.HorizontalAlignment getHorizontalAlignment() {
    com.google.apps.card.v1.Widget.HorizontalAlignment result =
        com.google.apps.card.v1.Widget.HorizontalAlignment.forNumber(horizontalAlignment_);
    return result == null
        ? com.google.apps.card.v1.Widget.HorizontalAlignment.UNRECOGNIZED
        : result;
  }

  public static final int EXPAND_BUTTON_FIELD_NUMBER = 2;
  private com.google.apps.card.v1.Button expandButton_;

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to expand the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button expand_button = 2;</code>
   *
   * @return Whether the expandButton field is set.
   */
  @java.lang.Override
  public boolean hasExpandButton() {
    return ((bitField0_ & 0x00000001) != 0);
  }

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to expand the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button expand_button = 2;</code>
   *
   * @return The expandButton.
   */
  @java.lang.Override
  public com.google.apps.card.v1.Button getExpandButton() {
    return expandButton_ == null
        ? com.google.apps.card.v1.Button.getDefaultInstance()
        : expandButton_;
  }

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to expand the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button expand_button = 2;</code>
   */
  @java.lang.Override
  public com.google.apps.card.v1.ButtonOrBuilder getExpandButtonOrBuilder() {
    return expandButton_ == null
        ? com.google.apps.card.v1.Button.getDefaultInstance()
        : expandButton_;
  }

  public static final int COLLAPSE_BUTTON_FIELD_NUMBER = 3;
  private com.google.apps.card.v1.Button collapseButton_;

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to collapse the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
   *
   * @return Whether the collapseButton field is set.
   */
  @java.lang.Override
  public boolean hasCollapseButton() {
    return ((bitField0_ & 0x00000002) != 0);
  }

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to collapse the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
   *
   * @return The collapseButton.
   */
  @java.lang.Override
  public com.google.apps.card.v1.Button getCollapseButton() {
    return collapseButton_ == null
        ? com.google.apps.card.v1.Button.getDefaultInstance()
        : collapseButton_;
  }

  /**
   *
   *
   * <pre>
   * Optional. Define a customizable button to collapse the section.
   * Both expand_button and collapse_button field must be set. Only one
   * field set will not take into effect.
   * If this field isn't set, the default button is used.
   * </pre>
   *
   * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
   */
  @java.lang.Override
  public com.google.apps.card.v1.ButtonOrBuilder getCollapseButtonOrBuilder() {
    return collapseButton_ == null
        ? com.google.apps.card.v1.Button.getDefaultInstance()
        : collapseButton_;
  }

  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 (horizontalAlignment_
        != com.google.apps.card.v1.Widget.HorizontalAlignment.HORIZONTAL_ALIGNMENT_UNSPECIFIED
            .getNumber()) {
      output.writeEnum(1, horizontalAlignment_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      output.writeMessage(2, getExpandButton());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      output.writeMessage(3, getCollapseButton());
    }
    getUnknownFields().writeTo(output);
  }

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

    size = 0;
    if (horizontalAlignment_
        != com.google.apps.card.v1.Widget.HorizontalAlignment.HORIZONTAL_ALIGNMENT_UNSPECIFIED
            .getNumber()) {
      size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, horizontalAlignment_);
    }
    if (((bitField0_ & 0x00000001) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getExpandButton());
    }
    if (((bitField0_ & 0x00000002) != 0)) {
      size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCollapseButton());
    }
    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.apps.card.v1.CollapseControl)) {
      return super.equals(obj);
    }
    com.google.apps.card.v1.CollapseControl other = (com.google.apps.card.v1.CollapseControl) obj;

    if (horizontalAlignment_ != other.horizontalAlignment_) return false;
    if (hasExpandButton() != other.hasExpandButton()) return false;
    if (hasExpandButton()) {
      if (!getExpandButton().equals(other.getExpandButton())) return false;
    }
    if (hasCollapseButton() != other.hasCollapseButton()) return false;
    if (hasCollapseButton()) {
      if (!getCollapseButton().equals(other.getCollapseButton())) 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) + HORIZONTAL_ALIGNMENT_FIELD_NUMBER;
    hash = (53 * hash) + horizontalAlignment_;
    if (hasExpandButton()) {
      hash = (37 * hash) + EXPAND_BUTTON_FIELD_NUMBER;
      hash = (53 * hash) + getExpandButton().hashCode();
    }
    if (hasCollapseButton()) {
      hash = (37 * hash) + COLLAPSE_BUTTON_FIELD_NUMBER;
      hash = (53 * hash) + getCollapseButton().hashCode();
    }
    hash = (29 * hash) + getUnknownFields().hashCode();
    memoizedHashCode = hash;
    return hash;
  }

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

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

  public static com.google.apps.card.v1.CollapseControl parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }

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

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

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

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

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

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

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

  public static com.google.apps.card.v1.CollapseControl parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessage.parseWithIOException(
        PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() {
    return newBuilder();
  }

  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }

  public static Builder newBuilder(com.google.apps.card.v1.CollapseControl prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }

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

  @java.lang.Override
  protected Builder newBuilderForType(com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }

  /**
   *
   *
   * <pre>
   * Represent an expand and collapse control.
   *
   * [Google Workspace add-ons and Chat
   * apps](https://developers.google.com/workspace/extend):
   * </pre>
   *
   * Protobuf type {@code google.apps.card.v1.CollapseControl}
   */
  public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder>
      implements
      // @@protoc_insertion_point(builder_implements:google.apps.card.v1.CollapseControl)
      com.google.apps.card.v1.CollapseControlOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
      return com.google.apps.card.v1.CardProto
          .internal_static_google_apps_card_v1_CollapseControl_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.google.apps.card.v1.CardProto
          .internal_static_google_apps_card_v1_CollapseControl_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.google.apps.card.v1.CollapseControl.class,
              com.google.apps.card.v1.CollapseControl.Builder.class);
    }

    // Construct using com.google.apps.card.v1.CollapseControl.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

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

    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        internalGetExpandButtonFieldBuilder();
        internalGetCollapseButtonFieldBuilder();
      }
    }

    @java.lang.Override
    public Builder clear() {
      super.clear();
      bitField0_ = 0;
      horizontalAlignment_ = 0;
      expandButton_ = null;
      if (expandButtonBuilder_ != null) {
        expandButtonBuilder_.dispose();
        expandButtonBuilder_ = null;
      }
      collapseButton_ = null;
      if (collapseButtonBuilder_ != null) {
        collapseButtonBuilder_.dispose();
        collapseButtonBuilder_ = null;
      }
      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
      return com.google.apps.card.v1.CardProto
          .internal_static_google_apps_card_v1_CollapseControl_descriptor;
    }

    @java.lang.Override
    public com.google.apps.card.v1.CollapseControl getDefaultInstanceForType() {
      return com.google.apps.card.v1.CollapseControl.getDefaultInstance();
    }

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

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

    private void buildPartial0(com.google.apps.card.v1.CollapseControl result) {
      int from_bitField0_ = bitField0_;
      if (((from_bitField0_ & 0x00000001) != 0)) {
        result.horizontalAlignment_ = horizontalAlignment_;
      }
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000002) != 0)) {
        result.expandButton_ =
            expandButtonBuilder_ == null ? expandButton_ : expandButtonBuilder_.build();
        to_bitField0_ |= 0x00000001;
      }
      if (((from_bitField0_ & 0x00000004) != 0)) {
        result.collapseButton_ =
            collapseButtonBuilder_ == null ? collapseButton_ : collapseButtonBuilder_.build();
        to_bitField0_ |= 0x00000002;
      }
      result.bitField0_ |= to_bitField0_;
    }

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

    public Builder mergeFrom(com.google.apps.card.v1.CollapseControl other) {
      if (other == com.google.apps.card.v1.CollapseControl.getDefaultInstance()) return this;
      if (other.horizontalAlignment_ != 0) {
        setHorizontalAlignmentValue(other.getHorizontalAlignmentValue());
      }
      if (other.hasExpandButton()) {
        mergeExpandButton(other.getExpandButton());
      }
      if (other.hasCollapseButton()) {
        mergeCollapseButton(other.getCollapseButton());
      }
      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:
              {
                horizontalAlignment_ = input.readEnum();
                bitField0_ |= 0x00000001;
                break;
              } // case 8
            case 18:
              {
                input.readMessage(
                    internalGetExpandButtonFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000002;
                break;
              } // case 18
            case 26:
              {
                input.readMessage(
                    internalGetCollapseButtonFieldBuilder().getBuilder(), extensionRegistry);
                bitField0_ |= 0x00000004;
                break;
              } // case 26
            default:
              {
                if (!super.parseUnknownField(input, extensionRegistry, tag)) {
                  done = true; // was an endgroup tag
                }
                break;
              } // default:
          } // switch (tag)
        } // while (!done)
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.unwrapIOException();
      } finally {
        onChanged();
      } // finally
      return this;
    }

    private int bitField0_;

    private int horizontalAlignment_ = 0;

    /**
     *
     *
     * <pre>
     * The horizontal alignment of the expand and collapse button.
     * </pre>
     *
     * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
     *
     * @return The enum numeric value on the wire for horizontalAlignment.
     */
    @java.lang.Override
    public int getHorizontalAlignmentValue() {
      return horizontalAlignment_;
    }

    /**
     *
     *
     * <pre>
     * The horizontal alignment of the expand and collapse button.
     * </pre>
     *
     * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
     *
     * @param value The enum numeric value on the wire for horizontalAlignment to set.
     * @return This builder for chaining.
     */
    public Builder setHorizontalAlignmentValue(int value) {
      horizontalAlignment_ = value;
      bitField0_ |= 0x00000001;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The horizontal alignment of the expand and collapse button.
     * </pre>
     *
     * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
     *
     * @return The horizontalAlignment.
     */
    @java.lang.Override
    public com.google.apps.card.v1.Widget.HorizontalAlignment getHorizontalAlignment() {
      com.google.apps.card.v1.Widget.HorizontalAlignment result =
          com.google.apps.card.v1.Widget.HorizontalAlignment.forNumber(horizontalAlignment_);
      return result == null
          ? com.google.apps.card.v1.Widget.HorizontalAlignment.UNRECOGNIZED
          : result;
    }

    /**
     *
     *
     * <pre>
     * The horizontal alignment of the expand and collapse button.
     * </pre>
     *
     * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
     *
     * @param value The horizontalAlignment to set.
     * @return This builder for chaining.
     */
    public Builder setHorizontalAlignment(
        com.google.apps.card.v1.Widget.HorizontalAlignment value) {
      if (value == null) {
        throw new NullPointerException();
      }
      bitField0_ |= 0x00000001;
      horizontalAlignment_ = value.getNumber();
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * The horizontal alignment of the expand and collapse button.
     * </pre>
     *
     * <code>.google.apps.card.v1.Widget.HorizontalAlignment horizontal_alignment = 1;</code>
     *
     * @return This builder for chaining.
     */
    public Builder clearHorizontalAlignment() {
      bitField0_ = (bitField0_ & ~0x00000001);
      horizontalAlignment_ = 0;
      onChanged();
      return this;
    }

    private com.google.apps.card.v1.Button expandButton_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.apps.card.v1.Button,
            com.google.apps.card.v1.Button.Builder,
            com.google.apps.card.v1.ButtonOrBuilder>
        expandButtonBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     *
     * @return Whether the expandButton field is set.
     */
    public boolean hasExpandButton() {
      return ((bitField0_ & 0x00000002) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     *
     * @return The expandButton.
     */
    public com.google.apps.card.v1.Button getExpandButton() {
      if (expandButtonBuilder_ == null) {
        return expandButton_ == null
            ? com.google.apps.card.v1.Button.getDefaultInstance()
            : expandButton_;
      } else {
        return expandButtonBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public Builder setExpandButton(com.google.apps.card.v1.Button value) {
      if (expandButtonBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        expandButton_ = value;
      } else {
        expandButtonBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public Builder setExpandButton(com.google.apps.card.v1.Button.Builder builderForValue) {
      if (expandButtonBuilder_ == null) {
        expandButton_ = builderForValue.build();
      } else {
        expandButtonBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000002;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public Builder mergeExpandButton(com.google.apps.card.v1.Button value) {
      if (expandButtonBuilder_ == null) {
        if (((bitField0_ & 0x00000002) != 0)
            && expandButton_ != null
            && expandButton_ != com.google.apps.card.v1.Button.getDefaultInstance()) {
          getExpandButtonBuilder().mergeFrom(value);
        } else {
          expandButton_ = value;
        }
      } else {
        expandButtonBuilder_.mergeFrom(value);
      }
      if (expandButton_ != null) {
        bitField0_ |= 0x00000002;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public Builder clearExpandButton() {
      bitField0_ = (bitField0_ & ~0x00000002);
      expandButton_ = null;
      if (expandButtonBuilder_ != null) {
        expandButtonBuilder_.dispose();
        expandButtonBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public com.google.apps.card.v1.Button.Builder getExpandButtonBuilder() {
      bitField0_ |= 0x00000002;
      onChanged();
      return internalGetExpandButtonFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    public com.google.apps.card.v1.ButtonOrBuilder getExpandButtonOrBuilder() {
      if (expandButtonBuilder_ != null) {
        return expandButtonBuilder_.getMessageOrBuilder();
      } else {
        return expandButton_ == null
            ? com.google.apps.card.v1.Button.getDefaultInstance()
            : expandButton_;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to expand the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button expand_button = 2;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.apps.card.v1.Button,
            com.google.apps.card.v1.Button.Builder,
            com.google.apps.card.v1.ButtonOrBuilder>
        internalGetExpandButtonFieldBuilder() {
      if (expandButtonBuilder_ == null) {
        expandButtonBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.apps.card.v1.Button,
                com.google.apps.card.v1.Button.Builder,
                com.google.apps.card.v1.ButtonOrBuilder>(
                getExpandButton(), getParentForChildren(), isClean());
        expandButton_ = null;
      }
      return expandButtonBuilder_;
    }

    private com.google.apps.card.v1.Button collapseButton_;
    private com.google.protobuf.SingleFieldBuilder<
            com.google.apps.card.v1.Button,
            com.google.apps.card.v1.Button.Builder,
            com.google.apps.card.v1.ButtonOrBuilder>
        collapseButtonBuilder_;

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     *
     * @return Whether the collapseButton field is set.
     */
    public boolean hasCollapseButton() {
      return ((bitField0_ & 0x00000004) != 0);
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     *
     * @return The collapseButton.
     */
    public com.google.apps.card.v1.Button getCollapseButton() {
      if (collapseButtonBuilder_ == null) {
        return collapseButton_ == null
            ? com.google.apps.card.v1.Button.getDefaultInstance()
            : collapseButton_;
      } else {
        return collapseButtonBuilder_.getMessage();
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public Builder setCollapseButton(com.google.apps.card.v1.Button value) {
      if (collapseButtonBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        collapseButton_ = value;
      } else {
        collapseButtonBuilder_.setMessage(value);
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public Builder setCollapseButton(com.google.apps.card.v1.Button.Builder builderForValue) {
      if (collapseButtonBuilder_ == null) {
        collapseButton_ = builderForValue.build();
      } else {
        collapseButtonBuilder_.setMessage(builderForValue.build());
      }
      bitField0_ |= 0x00000004;
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public Builder mergeCollapseButton(com.google.apps.card.v1.Button value) {
      if (collapseButtonBuilder_ == null) {
        if (((bitField0_ & 0x00000004) != 0)
            && collapseButton_ != null
            && collapseButton_ != com.google.apps.card.v1.Button.getDefaultInstance()) {
          getCollapseButtonBuilder().mergeFrom(value);
        } else {
          collapseButton_ = value;
        }
      } else {
        collapseButtonBuilder_.mergeFrom(value);
      }
      if (collapseButton_ != null) {
        bitField0_ |= 0x00000004;
        onChanged();
      }
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public Builder clearCollapseButton() {
      bitField0_ = (bitField0_ & ~0x00000004);
      collapseButton_ = null;
      if (collapseButtonBuilder_ != null) {
        collapseButtonBuilder_.dispose();
        collapseButtonBuilder_ = null;
      }
      onChanged();
      return this;
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public com.google.apps.card.v1.Button.Builder getCollapseButtonBuilder() {
      bitField0_ |= 0x00000004;
      onChanged();
      return internalGetCollapseButtonFieldBuilder().getBuilder();
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    public com.google.apps.card.v1.ButtonOrBuilder getCollapseButtonOrBuilder() {
      if (collapseButtonBuilder_ != null) {
        return collapseButtonBuilder_.getMessageOrBuilder();
      } else {
        return collapseButton_ == null
            ? com.google.apps.card.v1.Button.getDefaultInstance()
            : collapseButton_;
      }
    }

    /**
     *
     *
     * <pre>
     * Optional. Define a customizable button to collapse the section.
     * Both expand_button and collapse_button field must be set. Only one
     * field set will not take into effect.
     * If this field isn't set, the default button is used.
     * </pre>
     *
     * <code>.google.apps.card.v1.Button collapse_button = 3;</code>
     */
    private com.google.protobuf.SingleFieldBuilder<
            com.google.apps.card.v1.Button,
            com.google.apps.card.v1.Button.Builder,
            com.google.apps.card.v1.ButtonOrBuilder>
        internalGetCollapseButtonFieldBuilder() {
      if (collapseButtonBuilder_ == null) {
        collapseButtonBuilder_ =
            new com.google.protobuf.SingleFieldBuilder<
                com.google.apps.card.v1.Button,
                com.google.apps.card.v1.Button.Builder,
                com.google.apps.card.v1.ButtonOrBuilder>(
                getCollapseButton(), getParentForChildren(), isClean());
        collapseButton_ = null;
      }
      return collapseButtonBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:google.apps.card.v1.CollapseControl)
  }

  // @@protoc_insertion_point(class_scope:google.apps.card.v1.CollapseControl)
  private static final com.google.apps.card.v1.CollapseControl DEFAULT_INSTANCE;

  static {
    DEFAULT_INSTANCE = new com.google.apps.card.v1.CollapseControl();
  }

  public static com.google.apps.card.v1.CollapseControl getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

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

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

  @java.lang.Override
  public com.google.apps.card.v1.CollapseControl getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }
}
