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

namespace Google\Apps\Chat\V1;

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

/**
 * Request message for positioning a section.
 *
 * Generated from protobuf message <code>google.chat.v1.PositionSectionRequest</code>
 */
class PositionSectionRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource name of the section to position.
     * Format: `users/{user}/sections/{section}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $name = '';
    protected $position;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. The resource name of the section to position.
     *           Format: `users/{user}/sections/{section}`
     *     @type int $sort_order
     *           Optional. The absolute position of the section in the list of sections.
     *           The position must be greater than 0. If the position is greater than the
     *           number of sections, the section will be appended to the end of the list.
     *           This operation inserts the section at the given position and shifts the
     *           original section at that position, and those below it, to the next
     *           position.
     *     @type int $relative_position
     *           Optional. The relative position of the section in the list of sections.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Chat\V1\Section::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The resource name of the section to position.
     * Format: `users/{user}/sections/{section}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The resource name of the section to position.
     * Format: `users/{user}/sections/{section}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Optional. The absolute position of the section in the list of sections.
     * The position must be greater than 0. If the position is greater than the
     * number of sections, the section will be appended to the end of the list.
     * This operation inserts the section at the given position and shifts the
     * original section at that position, and those below it, to the next
     * position.
     *
     * Generated from protobuf field <code>int32 sort_order = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getSortOrder()
    {
        return $this->readOneof(2);
    }

    public function hasSortOrder()
    {
        return $this->hasOneof(2);
    }

    /**
     * Optional. The absolute position of the section in the list of sections.
     * The position must be greater than 0. If the position is greater than the
     * number of sections, the section will be appended to the end of the list.
     * This operation inserts the section at the given position and shifts the
     * original section at that position, and those below it, to the next
     * position.
     *
     * Generated from protobuf field <code>int32 sort_order = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setSortOrder($var)
    {
        GPBUtil::checkInt32($var);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Optional. The relative position of the section in the list of sections.
     *
     * Generated from protobuf field <code>.google.chat.v1.PositionSectionRequest.Position relative_position = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getRelativePosition()
    {
        return $this->readOneof(3);
    }

    public function hasRelativePosition()
    {
        return $this->hasOneof(3);
    }

    /**
     * Optional. The relative position of the section in the list of sections.
     *
     * Generated from protobuf field <code>.google.chat.v1.PositionSectionRequest.Position relative_position = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setRelativePosition($var)
    {
        GPBUtil::checkEnum($var, \Google\Apps\Chat\V1\PositionSectionRequest\Position::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getPosition()
    {
        return $this->whichOneof("position");
    }

}

