<?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.Metric</code>
 */
class Metric extends \Google\Protobuf\Internal\Message
{
    /**
     * Indicates that if client should export local metrics to server.
     *
     * Generated from protobuf field <code>bool on = 1;</code>
     */
    protected $on = false;
    /**
     * The endpoint that client metrics should be exported to, which is required if the switch is on.
     *
     * Generated from protobuf field <code>optional .apache.rocketmq.v2.Endpoints endpoints = 2;</code>
     */
    protected $endpoints = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $on
     *           Indicates that if client should export local metrics to server.
     *     @type \Apache\Rocketmq\V2\Endpoints $endpoints
     *           The endpoint that client metrics should be exported to, which is required if the switch is on.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Apache\Rocketmq\V2\Service::initOnce();
        parent::__construct($data);
    }

    /**
     * Indicates that if client should export local metrics to server.
     *
     * Generated from protobuf field <code>bool on = 1;</code>
     * @return bool
     */
    public function getOn()
    {
        return $this->on;
    }

    /**
     * Indicates that if client should export local metrics to server.
     *
     * Generated from protobuf field <code>bool on = 1;</code>
     * @param bool $var
     * @return $this
     */
    public function setOn($var)
    {
        GPBUtil::checkBool($var);
        $this->on = $var;

        return $this;
    }

    /**
     * The endpoint that client metrics should be exported to, which is required if the switch is on.
     *
     * Generated from protobuf field <code>optional .apache.rocketmq.v2.Endpoints endpoints = 2;</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);
    }

    /**
     * The endpoint that client metrics should be exported to, which is required if the switch is on.
     *
     * Generated from protobuf field <code>optional .apache.rocketmq.v2.Endpoints endpoints = 2;</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;
    }

}

