<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: apache/rocketmq/v2/service.proto

namespace Apache\Rocketmq\V2;

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

/**
 * Generated from protobuf message <code>apache.rocketmq.v2.Publishing</code>
 */
class Publishing extends \Google\Protobuf\Internal\Message
{
    /**
     * Publishing settings below here is appointed by client, thus it is
     * unnecessary for server to push at present.
     * List of topics to which messages will publish to.
     *
     * Generated from protobuf field <code>repeated .apache.rocketmq.v2.Resource topics = 1;</code>
     */
    private $topics;
    /**
     * If the message body size exceeds `max_body_size`, broker servers would
     * reject the request. As a result, it is advisable that Producer performs
     * client-side check validation.
     *
     * Generated from protobuf field <code>int32 max_body_size = 2;</code>
     */
    protected $max_body_size = 0;
    /**
     * When `validate_message_type` flag set `false`, no need to validate message's type
     * with messageQueue's `accept_message_types` before publishing.
     *
     * Generated from protobuf field <code>bool validate_message_type = 3;</code>
     */
    protected $validate_message_type = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Apache\Rocketmq\V2\Resource>|\Google\Protobuf\Internal\RepeatedField $topics
     *           Publishing settings below here is appointed by client, thus it is
     *           unnecessary for server to push at present.
     *           List of topics to which messages will publish to.
     *     @type int $max_body_size
     *           If the message body size exceeds `max_body_size`, broker servers would
     *           reject the request. As a result, it is advisable that Producer performs
     *           client-side check validation.
     *     @type bool $validate_message_type
     *           When `validate_message_type` flag set `false`, no need to validate message's type
     *           with messageQueue's `accept_message_types` before publishing.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Apache\Rocketmq\V2\Service::initOnce();
        parent::__construct($data);
    }

    /**
     * Publishing settings below here is appointed by client, thus it is
     * unnecessary for server to push at present.
     * List of topics to which messages will publish to.
     *
     * Generated from protobuf field <code>repeated .apache.rocketmq.v2.Resource topics = 1;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getTopics()
    {
        return $this->topics;
    }

    /**
     * Publishing settings below here is appointed by client, thus it is
     * unnecessary for server to push at present.
     * List of topics to which messages will publish to.
     *
     * Generated from protobuf field <code>repeated .apache.rocketmq.v2.Resource topics = 1;</code>
     * @param array<\Apache\Rocketmq\V2\Resource>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setTopics($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Apache\Rocketmq\V2\Resource::class);
        $this->topics = $arr;

        return $this;
    }

    /**
     * If the message body size exceeds `max_body_size`, broker servers would
     * reject the request. As a result, it is advisable that Producer performs
     * client-side check validation.
     *
     * Generated from protobuf field <code>int32 max_body_size = 2;</code>
     * @return int
     */
    public function getMaxBodySize()
    {
        return $this->max_body_size;
    }

    /**
     * If the message body size exceeds `max_body_size`, broker servers would
     * reject the request. As a result, it is advisable that Producer performs
     * client-side check validation.
     *
     * Generated from protobuf field <code>int32 max_body_size = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxBodySize($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_body_size = $var;

        return $this;
    }

    /**
     * When `validate_message_type` flag set `false`, no need to validate message's type
     * with messageQueue's `accept_message_types` before publishing.
     *
     * Generated from protobuf field <code>bool validate_message_type = 3;</code>
     * @return bool
     */
    public function getValidateMessageType()
    {
        return $this->validate_message_type;
    }

    /**
     * When `validate_message_type` flag set `false`, no need to validate message's type
     * with messageQueue's `accept_message_types` before publishing.
     *
     * Generated from protobuf field <code>bool validate_message_type = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setValidateMessageType($var)
    {
        GPBUtil::checkBool($var);
        $this->validate_message_type = $var;

        return $this;
    }

}

