<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/apps/card/v1/card.proto

namespace Google\Apps\Card\V1\Card;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A section contains a collection of widgets that are rendered
 * vertically in the order that they're specified.
 * [Google Workspace add-ons and Chat
 * apps](https://developers.google.com/workspace/extend):
 *
 * Generated from protobuf message <code>google.apps.card.v1.Card.Section</code>
 */
class Section extends \Google\Protobuf\Internal\Message
{
    /**
     * Text that appears at the top of a section.
     * Supports simple HTML formatted text. For more information
     * about formatting text, see
     * [Formatting text in Google Chat
     * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
     * and
     * [Formatting
     * text in Google Workspace
     * add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
     *
     * Generated from protobuf field <code>string header = 1;</code>
     */
    protected $header = '';
    /**
     * All the widgets in the section.
     * Must contain at least one widget.
     *
     * Generated from protobuf field <code>repeated .google.apps.card.v1.Widget widgets = 2;</code>
     */
    private $widgets;
    /**
     * Indicates whether this section is collapsible.
     * Collapsible sections hide some or all widgets, but users can expand the
     * section to reveal the hidden widgets by clicking **Show more**. Users
     * can hide the widgets again by clicking **Show less**.
     * To determine which widgets are hidden, specify
     * `uncollapsibleWidgetsCount`.
     *
     * Generated from protobuf field <code>bool collapsible = 5;</code>
     */
    protected $collapsible = false;
    /**
     * The number of uncollapsible widgets which remain visible even when a
     * section is collapsed.
     * For example, when a section
     * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`,
     * the first two widgets are always shown and the last three are collapsed
     * by default. The `uncollapsibleWidgetsCount` is taken into account only
     * when `collapsible` is `true`.
     *
     * Generated from protobuf field <code>int32 uncollapsible_widgets_count = 6;</code>
     */
    protected $uncollapsible_widgets_count = 0;
    /**
     * Optional. Define the expand and collapse button of the section.
     * This button will be shown only if the section is collapsible.
     * If this field isn't set, the default button is used.
     *
     * Generated from protobuf field <code>.google.apps.card.v1.CollapseControl collapse_control = 8;</code>
     */
    protected $collapse_control = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $header
     *           Text that appears at the top of a section.
     *           Supports simple HTML formatted text. For more information
     *           about formatting text, see
     *           [Formatting text in Google Chat
     *           apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
     *           and
     *           [Formatting
     *           text in Google Workspace
     *           add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
     *     @type array<\Google\Apps\Card\V1\Widget>|\Google\Protobuf\Internal\RepeatedField $widgets
     *           All the widgets in the section.
     *           Must contain at least one widget.
     *     @type bool $collapsible
     *           Indicates whether this section is collapsible.
     *           Collapsible sections hide some or all widgets, but users can expand the
     *           section to reveal the hidden widgets by clicking **Show more**. Users
     *           can hide the widgets again by clicking **Show less**.
     *           To determine which widgets are hidden, specify
     *           `uncollapsibleWidgetsCount`.
     *     @type int $uncollapsible_widgets_count
     *           The number of uncollapsible widgets which remain visible even when a
     *           section is collapsed.
     *           For example, when a section
     *           contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`,
     *           the first two widgets are always shown and the last three are collapsed
     *           by default. The `uncollapsibleWidgetsCount` is taken into account only
     *           when `collapsible` is `true`.
     *     @type \Google\Apps\Card\V1\CollapseControl $collapse_control
     *           Optional. Define the expand and collapse button of the section.
     *           This button will be shown only if the section is collapsible.
     *           If this field isn't set, the default button is used.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Apps\Card\V1\Card::initOnce();
        parent::__construct($data);
    }

    /**
     * Text that appears at the top of a section.
     * Supports simple HTML formatted text. For more information
     * about formatting text, see
     * [Formatting text in Google Chat
     * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
     * and
     * [Formatting
     * text in Google Workspace
     * add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
     *
     * Generated from protobuf field <code>string header = 1;</code>
     * @return string
     */
    public function getHeader()
    {
        return $this->header;
    }

    /**
     * Text that appears at the top of a section.
     * Supports simple HTML formatted text. For more information
     * about formatting text, see
     * [Formatting text in Google Chat
     * apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
     * and
     * [Formatting
     * text in Google Workspace
     * add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
     *
     * Generated from protobuf field <code>string header = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setHeader($var)
    {
        GPBUtil::checkString($var, True);
        $this->header = $var;

        return $this;
    }

    /**
     * All the widgets in the section.
     * Must contain at least one widget.
     *
     * Generated from protobuf field <code>repeated .google.apps.card.v1.Widget widgets = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getWidgets()
    {
        return $this->widgets;
    }

    /**
     * All the widgets in the section.
     * Must contain at least one widget.
     *
     * Generated from protobuf field <code>repeated .google.apps.card.v1.Widget widgets = 2;</code>
     * @param array<\Google\Apps\Card\V1\Widget>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setWidgets($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Apps\Card\V1\Widget::class);
        $this->widgets = $arr;

        return $this;
    }

    /**
     * Indicates whether this section is collapsible.
     * Collapsible sections hide some or all widgets, but users can expand the
     * section to reveal the hidden widgets by clicking **Show more**. Users
     * can hide the widgets again by clicking **Show less**.
     * To determine which widgets are hidden, specify
     * `uncollapsibleWidgetsCount`.
     *
     * Generated from protobuf field <code>bool collapsible = 5;</code>
     * @return bool
     */
    public function getCollapsible()
    {
        return $this->collapsible;
    }

    /**
     * Indicates whether this section is collapsible.
     * Collapsible sections hide some or all widgets, but users can expand the
     * section to reveal the hidden widgets by clicking **Show more**. Users
     * can hide the widgets again by clicking **Show less**.
     * To determine which widgets are hidden, specify
     * `uncollapsibleWidgetsCount`.
     *
     * Generated from protobuf field <code>bool collapsible = 5;</code>
     * @param bool $var
     * @return $this
     */
    public function setCollapsible($var)
    {
        GPBUtil::checkBool($var);
        $this->collapsible = $var;

        return $this;
    }

    /**
     * The number of uncollapsible widgets which remain visible even when a
     * section is collapsed.
     * For example, when a section
     * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`,
     * the first two widgets are always shown and the last three are collapsed
     * by default. The `uncollapsibleWidgetsCount` is taken into account only
     * when `collapsible` is `true`.
     *
     * Generated from protobuf field <code>int32 uncollapsible_widgets_count = 6;</code>
     * @return int
     */
    public function getUncollapsibleWidgetsCount()
    {
        return $this->uncollapsible_widgets_count;
    }

    /**
     * The number of uncollapsible widgets which remain visible even when a
     * section is collapsed.
     * For example, when a section
     * contains five widgets and the `uncollapsibleWidgetsCount` is set to `2`,
     * the first two widgets are always shown and the last three are collapsed
     * by default. The `uncollapsibleWidgetsCount` is taken into account only
     * when `collapsible` is `true`.
     *
     * Generated from protobuf field <code>int32 uncollapsible_widgets_count = 6;</code>
     * @param int $var
     * @return $this
     */
    public function setUncollapsibleWidgetsCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->uncollapsible_widgets_count = $var;

        return $this;
    }

    /**
     * Optional. Define the expand and collapse button of the section.
     * This button will be shown only if the section is collapsible.
     * If this field isn't set, the default button is used.
     *
     * Generated from protobuf field <code>.google.apps.card.v1.CollapseControl collapse_control = 8;</code>
     * @return \Google\Apps\Card\V1\CollapseControl|null
     */
    public function getCollapseControl()
    {
        return $this->collapse_control;
    }

    public function hasCollapseControl()
    {
        return isset($this->collapse_control);
    }

    public function clearCollapseControl()
    {
        unset($this->collapse_control);
    }

    /**
     * Optional. Define the expand and collapse button of the section.
     * This button will be shown only if the section is collapsible.
     * If this field isn't set, the default button is used.
     *
     * Generated from protobuf field <code>.google.apps.card.v1.CollapseControl collapse_control = 8;</code>
     * @param \Google\Apps\Card\V1\CollapseControl $var
     * @return $this
     */
    public function setCollapseControl($var)
    {
        GPBUtil::checkMessage($var, \Google\Apps\Card\V1\CollapseControl::class);
        $this->collapse_control = $var;

        return $this;
    }

}


