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

namespace Grpc\Testing;

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

/**
 * Generated from protobuf message <code>grpc.testing.LoadBalancerStatsResponse</code>
 */
class LoadBalancerStatsResponse extends \Google\Protobuf\Internal\Message
{
    /**
     * The number of completed RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
     */
    private $rpcs_by_peer;
    /**
     * The number of RPCs that failed to record a remote peer.
     *
     * Generated from protobuf field <code>int32 num_failures = 2;</code>
     */
    protected $num_failures = 0;
    /**
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.RpcsByPeer> rpcs_by_method = 3;</code>
     */
    private $rpcs_by_method;
    /**
     * All the metadata of all RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.MetadataByPeer> metadatas_by_peer = 4;</code>
     */
    private $metadatas_by_peer;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array|\Google\Protobuf\Internal\MapField $rpcs_by_peer
     *           The number of completed RPCs for each peer.
     *     @type int $num_failures
     *           The number of RPCs that failed to record a remote peer.
     *     @type array|\Google\Protobuf\Internal\MapField $rpcs_by_method
     *     @type array|\Google\Protobuf\Internal\MapField $metadatas_by_peer
     *           All the metadata of all RPCs for each peer.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Src\Proto\Grpc\Testing\Messages::initOnce();
        parent::__construct($data);
    }

    /**
     * The number of completed RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getRpcsByPeer()
    {
        return $this->rpcs_by_peer;
    }

    /**
     * The number of completed RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, int32> rpcs_by_peer = 1;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setRpcsByPeer($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::INT32);
        $this->rpcs_by_peer = $arr;

        return $this;
    }

    /**
     * The number of RPCs that failed to record a remote peer.
     *
     * Generated from protobuf field <code>int32 num_failures = 2;</code>
     * @return int
     */
    public function getNumFailures()
    {
        return $this->num_failures;
    }

    /**
     * The number of RPCs that failed to record a remote peer.
     *
     * Generated from protobuf field <code>int32 num_failures = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setNumFailures($var)
    {
        GPBUtil::checkInt32($var);
        $this->num_failures = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.RpcsByPeer> rpcs_by_method = 3;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getRpcsByMethod()
    {
        return $this->rpcs_by_method;
    }

    /**
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.RpcsByPeer> rpcs_by_method = 3;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setRpcsByMethod($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\LoadBalancerStatsResponse\RpcsByPeer::class);
        $this->rpcs_by_method = $arr;

        return $this;
    }

    /**
     * All the metadata of all RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.MetadataByPeer> metadatas_by_peer = 4;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getMetadatasByPeer()
    {
        return $this->metadatas_by_peer;
    }

    /**
     * All the metadata of all RPCs for each peer.
     *
     * Generated from protobuf field <code>map<string, .grpc.testing.LoadBalancerStatsResponse.MetadataByPeer> metadatas_by_peer = 4;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setMetadatasByPeer($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grpc\Testing\LoadBalancerStatsResponse\MetadataByPeer::class);
        $this->metadatas_by_peer = $arr;

        return $this;
    }

}

