<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: livekit_metrics.proto

namespace Livekit;

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

/**
 * Generated from protobuf message <code>livekit.MetricsBatch</code>
 */
class MetricsBatch extends \Google\Protobuf\Internal\Message
{
    /**
     * time at which this batch is sent based on a monotonic clock (millisecond resolution)
     *
     * Generated from protobuf field <code>int64 timestamp_ms = 1;</code>
     */
    protected $timestamp_ms = 0;
    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp normalized_timestamp = 2;</code>
     */
    protected $normalized_timestamp = null;
    /**
     * To avoid repeating string values, we store them in a separate list and reference them by index
     * This is useful for storing participant identities, track names, etc.
     * There is also a predefined list of labels that can be used to reference common metrics.
     * They have reserved indices from 0 to (METRIC_LABEL_PREDEFINED_MAX_VALUE - 1).
     * Indexes pointing at str_data should start from METRIC_LABEL_PREDEFINED_MAX_VALUE,
     * such that str_data[0] == index of METRIC_LABEL_PREDEFINED_MAX_VALUE.
     *
     * Generated from protobuf field <code>repeated string str_data = 3;</code>
     */
    private $str_data;
    /**
     * Generated from protobuf field <code>repeated .livekit.TimeSeriesMetric time_series = 4;</code>
     */
    private $time_series;
    /**
     * Generated from protobuf field <code>repeated .livekit.EventMetric events = 5;</code>
     */
    private $events;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $timestamp_ms
     *           time at which this batch is sent based on a monotonic clock (millisecond resolution)
     *     @type \Google\Protobuf\Timestamp $normalized_timestamp
     *     @type string[] $str_data
     *           To avoid repeating string values, we store them in a separate list and reference them by index
     *           This is useful for storing participant identities, track names, etc.
     *           There is also a predefined list of labels that can be used to reference common metrics.
     *           They have reserved indices from 0 to (METRIC_LABEL_PREDEFINED_MAX_VALUE - 1).
     *           Indexes pointing at str_data should start from METRIC_LABEL_PREDEFINED_MAX_VALUE,
     *           such that str_data[0] == index of METRIC_LABEL_PREDEFINED_MAX_VALUE.
     *     @type \Livekit\TimeSeriesMetric[] $time_series
     *     @type \Livekit\EventMetric[] $events
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\LivekitMetrics::initOnce();
        parent::__construct($data);
    }

    /**
     * time at which this batch is sent based on a monotonic clock (millisecond resolution)
     *
     * Generated from protobuf field <code>int64 timestamp_ms = 1;</code>
     * @return int|string
     */
    public function getTimestampMs()
    {
        return $this->timestamp_ms;
    }

    /**
     * time at which this batch is sent based on a monotonic clock (millisecond resolution)
     *
     * Generated from protobuf field <code>int64 timestamp_ms = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimestampMs($var)
    {
        GPBUtil::checkInt64($var);
        $this->timestamp_ms = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp normalized_timestamp = 2;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getNormalizedTimestamp()
    {
        return $this->normalized_timestamp;
    }

    public function hasNormalizedTimestamp()
    {
        return isset($this->normalized_timestamp);
    }

    public function clearNormalizedTimestamp()
    {
        unset($this->normalized_timestamp);
    }

    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp normalized_timestamp = 2;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setNormalizedTimestamp($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->normalized_timestamp = $var;

        return $this;
    }

    /**
     * To avoid repeating string values, we store them in a separate list and reference them by index
     * This is useful for storing participant identities, track names, etc.
     * There is also a predefined list of labels that can be used to reference common metrics.
     * They have reserved indices from 0 to (METRIC_LABEL_PREDEFINED_MAX_VALUE - 1).
     * Indexes pointing at str_data should start from METRIC_LABEL_PREDEFINED_MAX_VALUE,
     * such that str_data[0] == index of METRIC_LABEL_PREDEFINED_MAX_VALUE.
     *
     * Generated from protobuf field <code>repeated string str_data = 3;</code>
     * @return RepeatedField<string>
     */
    public function getStrData()
    {
        return $this->str_data;
    }

    /**
     * To avoid repeating string values, we store them in a separate list and reference them by index
     * This is useful for storing participant identities, track names, etc.
     * There is also a predefined list of labels that can be used to reference common metrics.
     * They have reserved indices from 0 to (METRIC_LABEL_PREDEFINED_MAX_VALUE - 1).
     * Indexes pointing at str_data should start from METRIC_LABEL_PREDEFINED_MAX_VALUE,
     * such that str_data[0] == index of METRIC_LABEL_PREDEFINED_MAX_VALUE.
     *
     * Generated from protobuf field <code>repeated string str_data = 3;</code>
     * @param string[] $var
     * @return $this
     */
    public function setStrData($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->str_data = $arr;

        return $this;
    }

    /**
     * Generated from protobuf field <code>repeated .livekit.TimeSeriesMetric time_series = 4;</code>
     * @return RepeatedField<\Livekit\TimeSeriesMetric>
     */
    public function getTimeSeries()
    {
        return $this->time_series;
    }

    /**
     * Generated from protobuf field <code>repeated .livekit.TimeSeriesMetric time_series = 4;</code>
     * @param \Livekit\TimeSeriesMetric[] $var
     * @return $this
     */
    public function setTimeSeries($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Livekit\TimeSeriesMetric::class);
        $this->time_series = $arr;

        return $this;
    }

    /**
     * Generated from protobuf field <code>repeated .livekit.EventMetric events = 5;</code>
     * @return RepeatedField<\Livekit\EventMetric>
     */
    public function getEvents()
    {
        return $this->events;
    }

    /**
     * Generated from protobuf field <code>repeated .livekit.EventMetric events = 5;</code>
     * @param \Livekit\EventMetric[] $var
     * @return $this
     */
    public function setEvents($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Livekit\EventMetric::class);
        $this->events = $arr;

        return $this;
    }

}

