<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/container/v1/cluster_service.proto

namespace Google\Cloud\Container\V1\OperationProgress;

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

/**
 * Progress metric is (string, int|float|string) pair.
 *
 * Generated from protobuf message <code>google.container.v1.OperationProgress.Metric</code>
 */
class Metric extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Metric name, e.g., "nodes total", "percent done".
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $name = '';
    protected $value;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. Metric name, e.g., "nodes total", "percent done".
     *     @type int|string $int_value
     *           For metrics with integer value.
     *     @type float $double_value
     *           For metrics with floating point value.
     *     @type string $string_value
     *           For metrics with custom values (ratios, visual progress, etc.).
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Container\V1\ClusterService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Metric name, e.g., "nodes total", "percent done".
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. Metric name, e.g., "nodes total", "percent done".
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * For metrics with integer value.
     *
     * Generated from protobuf field <code>int64 int_value = 2;</code>
     * @return int|string
     */
    public function getIntValue()
    {
        return $this->readOneof(2);
    }

    public function hasIntValue()
    {
        return $this->hasOneof(2);
    }

    /**
     * For metrics with integer value.
     *
     * Generated from protobuf field <code>int64 int_value = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setIntValue($var)
    {
        GPBUtil::checkInt64($var);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * For metrics with floating point value.
     *
     * Generated from protobuf field <code>double double_value = 3;</code>
     * @return float
     */
    public function getDoubleValue()
    {
        return $this->readOneof(3);
    }

    public function hasDoubleValue()
    {
        return $this->hasOneof(3);
    }

    /**
     * For metrics with floating point value.
     *
     * Generated from protobuf field <code>double double_value = 3;</code>
     * @param float $var
     * @return $this
     */
    public function setDoubleValue($var)
    {
        GPBUtil::checkDouble($var);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * For metrics with custom values (ratios, visual progress, etc.).
     *
     * Generated from protobuf field <code>string string_value = 4;</code>
     * @return string
     */
    public function getStringValue()
    {
        return $this->readOneof(4);
    }

    public function hasStringValue()
    {
        return $this->hasOneof(4);
    }

    /**
     * For metrics with custom values (ratios, visual progress, etc.).
     *
     * Generated from protobuf field <code>string string_value = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setStringValue($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(4, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Metric::class, \Google\Cloud\Container\V1\OperationProgress_Metric::class);

