<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: dy.proto

namespace Douyin;

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

/**
 * Generated from protobuf message <code>douyin.Text</code>
 */
class Text extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>string key = 1;</code>
     */
    protected $key = '';
    /**
     * Generated from protobuf field <code>string defaultPatter = 2;</code>
     */
    protected $defaultPatter = '';
    /**
     * Generated from protobuf field <code>.douyin.TextFormat defaultFormat = 3;</code>
     */
    protected $defaultFormat = null;
    /**
     * Generated from protobuf field <code>repeated .douyin.TextPiece piecesList = 4;</code>
     */
    private $piecesList;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $key
     *     @type string $defaultPatter
     *     @type \Douyin\TextFormat $defaultFormat
     *     @type array<\Douyin\TextPiece>|\Google\Protobuf\Internal\RepeatedField $piecesList
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Dy::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>string key = 1;</code>
     * @return string
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * Generated from protobuf field <code>string key = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string defaultPatter = 2;</code>
     * @return string
     */
    public function getDefaultPatter()
    {
        return $this->defaultPatter;
    }

    /**
     * Generated from protobuf field <code>string defaultPatter = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setDefaultPatter($var)
    {
        GPBUtil::checkString($var, True);
        $this->defaultPatter = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.douyin.TextFormat defaultFormat = 3;</code>
     * @return \Douyin\TextFormat|null
     */
    public function getDefaultFormat()
    {
        return $this->defaultFormat;
    }

    public function hasDefaultFormat()
    {
        return isset($this->defaultFormat);
    }

    public function clearDefaultFormat()
    {
        unset($this->defaultFormat);
    }

    /**
     * Generated from protobuf field <code>.douyin.TextFormat defaultFormat = 3;</code>
     * @param \Douyin\TextFormat $var
     * @return $this
     */
    public function setDefaultFormat($var)
    {
        GPBUtil::checkMessage($var, \Douyin\TextFormat::class);
        $this->defaultFormat = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>repeated .douyin.TextPiece piecesList = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPiecesList()
    {
        return $this->piecesList;
    }

    /**
     * Generated from protobuf field <code>repeated .douyin.TextPiece piecesList = 4;</code>
     * @param array<\Douyin\TextPiece>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPiecesList($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Douyin\TextPiece::class);
        $this->piecesList = $arr;

        return $this;
    }

}

