<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/bigquery/migration/v2/migration_metrics.proto

namespace Google\Cloud\BigQuery\Migration\V2;

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

/**
 * The metrics object for a SubTask.
 *
 * Generated from protobuf message <code>google.cloud.bigquery.migration.v2.TimeSeries</code>
 */
class TimeSeries extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The name of the metric.
     * If the metric is not known by the service yet, it will be auto-created.
     *
     * Generated from protobuf field <code>string metric = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $metric = '';
    /**
     * Required. The value type of the time series.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.ValueType value_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $value_type = 0;
    /**
     * Optional. The metric kind of the time series.
     * If present, it must be the same as the metric kind of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * this field specifies the metric kind of the new descriptor and must be
     * either `GAUGE` (the default) or `CUMULATIVE`.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.MetricKind metric_kind = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $metric_kind = 0;
    /**
     * Required. The data points of this time series. When listing time series, points are
     * returned in reverse time order.
     * When creating a time series, this field must contain exactly one point and
     * the point's type must be the same as the value type of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * the value type of the descriptor is determined by the point's type, which
     * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
     *
     * Generated from protobuf field <code>repeated .google.cloud.bigquery.migration.v2.Point points = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $points;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $metric
     *           Required. The name of the metric.
     *           If the metric is not known by the service yet, it will be auto-created.
     *     @type int $value_type
     *           Required. The value type of the time series.
     *     @type int $metric_kind
     *           Optional. The metric kind of the time series.
     *           If present, it must be the same as the metric kind of the associated
     *           metric. If the associated metric's descriptor must be auto-created, then
     *           this field specifies the metric kind of the new descriptor and must be
     *           either `GAUGE` (the default) or `CUMULATIVE`.
     *     @type array<\Google\Cloud\BigQuery\Migration\V2\Point>|\Google\Protobuf\Internal\RepeatedField $points
     *           Required. The data points of this time series. When listing time series, points are
     *           returned in reverse time order.
     *           When creating a time series, this field must contain exactly one point and
     *           the point's type must be the same as the value type of the associated
     *           metric. If the associated metric's descriptor must be auto-created, then
     *           the value type of the descriptor is determined by the point's type, which
     *           must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Bigquery\Migration\V2\MigrationMetrics::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The name of the metric.
     * If the metric is not known by the service yet, it will be auto-created.
     *
     * Generated from protobuf field <code>string metric = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getMetric()
    {
        return $this->metric;
    }

    /**
     * Required. The name of the metric.
     * If the metric is not known by the service yet, it will be auto-created.
     *
     * Generated from protobuf field <code>string metric = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setMetric($var)
    {
        GPBUtil::checkString($var, True);
        $this->metric = $var;

        return $this;
    }

    /**
     * Required. The value type of the time series.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.ValueType value_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getValueType()
    {
        return $this->value_type;
    }

    /**
     * Required. The value type of the time series.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.ValueType value_type = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setValueType($var)
    {
        GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\ValueType::class);
        $this->value_type = $var;

        return $this;
    }

    /**
     * Optional. The metric kind of the time series.
     * If present, it must be the same as the metric kind of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * this field specifies the metric kind of the new descriptor and must be
     * either `GAUGE` (the default) or `CUMULATIVE`.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.MetricKind metric_kind = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getMetricKind()
    {
        return $this->metric_kind;
    }

    /**
     * Optional. The metric kind of the time series.
     * If present, it must be the same as the metric kind of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * this field specifies the metric kind of the new descriptor and must be
     * either `GAUGE` (the default) or `CUMULATIVE`.
     *
     * Generated from protobuf field <code>.google.api.MetricDescriptor.MetricKind metric_kind = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setMetricKind($var)
    {
        GPBUtil::checkEnum($var, \Google\Api\MetricDescriptor\MetricKind::class);
        $this->metric_kind = $var;

        return $this;
    }

    /**
     * Required. The data points of this time series. When listing time series, points are
     * returned in reverse time order.
     * When creating a time series, this field must contain exactly one point and
     * the point's type must be the same as the value type of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * the value type of the descriptor is determined by the point's type, which
     * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
     *
     * Generated from protobuf field <code>repeated .google.cloud.bigquery.migration.v2.Point points = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPoints()
    {
        return $this->points;
    }

    /**
     * Required. The data points of this time series. When listing time series, points are
     * returned in reverse time order.
     * When creating a time series, this field must contain exactly one point and
     * the point's type must be the same as the value type of the associated
     * metric. If the associated metric's descriptor must be auto-created, then
     * the value type of the descriptor is determined by the point's type, which
     * must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`.
     *
     * Generated from protobuf field <code>repeated .google.cloud.bigquery.migration.v2.Point points = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\BigQuery\Migration\V2\Point>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPoints($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\BigQuery\Migration\V2\Point::class);
        $this->points = $arr;

        return $this;
    }

}

