<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: src/proto/grpc/core/stats.proto

namespace Grpc\Core;

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

/**
 * Generated from protobuf message <code>grpc.core.Metric</code>
 */
class Metric extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>string name = 1;</code>
     */
    protected $name = '';
    protected $value;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *     @type int|string $count
     *     @type \Grpc\Core\Histogram $histogram
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Src\Proto\Grpc\Core\Stats::initOnce();
        parent::__construct($data);
    }

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

    /**
     * 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;
    }

    /**
     * Generated from protobuf field <code>uint64 count = 10;</code>
     * @return int|string
     */
    public function getCount()
    {
        return $this->readOneof(10);
    }

    /**
     * Generated from protobuf field <code>uint64 count = 10;</code>
     * @param int|string $var
     * @return $this
     */
    public function setCount($var)
    {
        GPBUtil::checkUint64($var);
        $this->writeOneof(10, $var);

        return $this;
    }

    /**
     * Generated from protobuf field <code>.grpc.core.Histogram histogram = 11;</code>
     * @return \Grpc\Core\Histogram
     */
    public function getHistogram()
    {
        return $this->readOneof(11);
    }

    /**
     * Generated from protobuf field <code>.grpc.core.Histogram histogram = 11;</code>
     * @param \Grpc\Core\Histogram $var
     * @return $this
     */
    public function setHistogram($var)
    {
        GPBUtil::checkMessage($var, \Grpc\Core\Histogram::class);
        $this->writeOneof(11, $var);

        return $this;
    }

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

}

