<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: apache/rocketmq/v2/definition.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.Broker</code>
 */
class Broker extends \Google\Protobuf\Internal\Message
{
    /**
     * Name of the broker
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    protected $name = '';
    /**
     * Broker index. Canonically, index = 0 implies that the broker is playing
     * leader role while brokers with index > 0 play follower role.
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     */
    protected $id = 0;
    /**
     * Address of the broker, complying with the following scheme
     * 1. dns:[//authority/]host[:port]
     * 2. ipv4:address[:port][,address[:port],...] – IPv4 addresses
     * 3. ipv6:address[:port][,address[:port],...] – IPv6 addresses
     *
     * Generated from protobuf field <code>.apache.rocketmq.v2.Endpoints endpoints = 3;</code>
     */
    protected $endpoints = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Name of the broker
     *     @type int $id
     *           Broker index. Canonically, index = 0 implies that the broker is playing
     *           leader role while brokers with index > 0 play follower role.
     *     @type \Apache\Rocketmq\V2\Endpoints $endpoints
     *           Address of the broker, complying with the following scheme
     *           1. dns:[//authority/]host[:port]
     *           2. ipv4:address[:port][,address[:port],...] – IPv4 addresses
     *           3. ipv6:address[:port][,address[:port],...] – IPv6 addresses
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Apache\Rocketmq\V2\Definition::initOnce();
        parent::__construct($data);
    }

    /**
     * Name of the broker
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Name of the broker
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Broker index. Canonically, index = 0 implies that the broker is playing
     * leader role while brokers with index > 0 play follower role.
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Broker index. Canonically, index = 0 implies that the broker is playing
     * leader role while brokers with index > 0 play follower role.
     *
     * Generated from protobuf field <code>int32 id = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkInt32($var);
        $this->id = $var;

        return $this;
    }

    /**
     * Address of the broker, complying with the following scheme
     * 1. dns:[//authority/]host[:port]
     * 2. ipv4:address[:port][,address[:port],...] – IPv4 addresses
     * 3. ipv6:address[:port][,address[:port],...] – IPv6 addresses
     *
     * Generated from protobuf field <code>.apache.rocketmq.v2.Endpoints endpoints = 3;</code>
     * @return \Apache\Rocketmq\V2\Endpoints|null
     */
    public function getEndpoints()
    {
        return $this->endpoints;
    }

    public function hasEndpoints()
    {
        return isset($this->endpoints);
    }

    public function clearEndpoints()
    {
        unset($this->endpoints);
    }

    /**
     * Address of the broker, complying with the following scheme
     * 1. dns:[//authority/]host[:port]
     * 2. ipv4:address[:port][,address[:port],...] – IPv4 addresses
     * 3. ipv6:address[:port][,address[:port],...] – IPv6 addresses
     *
     * Generated from protobuf field <code>.apache.rocketmq.v2.Endpoints endpoints = 3;</code>
     * @param \Apache\Rocketmq\V2\Endpoints $var
     * @return $this
     */
    public function setEndpoints($var)
    {
        GPBUtil::checkMessage($var, \Apache\Rocketmq\V2\Endpoints::class);
        $this->endpoints = $var;

        return $this;
    }

}

