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

namespace Google\Cloud\Compute\V1;

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

/**
 * Encapsulates numeric value that can be either absolute or relative.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.FixedOrPercent</code>
 */
class FixedOrPercent extends \Google\Protobuf\Internal\Message
{
    /**
     * [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded. 
     *
     * Generated from protobuf field <code>optional int32 calculated = 472082878;</code>
     */
    private $calculated = null;
    /**
     * Specifies a fixed number of VM instances. This must be a positive integer.
     *
     * Generated from protobuf field <code>optional int32 fixed = 97445748;</code>
     */
    private $fixed = null;
    /**
     * Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
     *
     * Generated from protobuf field <code>optional int32 percent = 394814533;</code>
     */
    private $percent = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $calculated
     *           [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded. 
     *     @type int $fixed
     *           Specifies a fixed number of VM instances. This must be a positive integer.
     *     @type int $percent
     *           Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded. 
     *
     * Generated from protobuf field <code>optional int32 calculated = 472082878;</code>
     * @return int
     */
    public function getCalculated()
    {
        return isset($this->calculated) ? $this->calculated : 0;
    }

    public function hasCalculated()
    {
        return isset($this->calculated);
    }

    public function clearCalculated()
    {
        unset($this->calculated);
    }

    /**
     * [Output Only] Absolute value of VM instances calculated based on the specific mode. - If the value is fixed, then the calculated value is equal to the fixed value. - If the value is a percent, then the calculated value is percent/100 * targetSize. For example, the calculated value of a 80% of a managed instance group with 150 instances would be (80/100 * 150) = 120 VM instances. If there is a remainder, the number is rounded. 
     *
     * Generated from protobuf field <code>optional int32 calculated = 472082878;</code>
     * @param int $var
     * @return $this
     */
    public function setCalculated($var)
    {
        GPBUtil::checkInt32($var);
        $this->calculated = $var;

        return $this;
    }

    /**
     * Specifies a fixed number of VM instances. This must be a positive integer.
     *
     * Generated from protobuf field <code>optional int32 fixed = 97445748;</code>
     * @return int
     */
    public function getFixed()
    {
        return isset($this->fixed) ? $this->fixed : 0;
    }

    public function hasFixed()
    {
        return isset($this->fixed);
    }

    public function clearFixed()
    {
        unset($this->fixed);
    }

    /**
     * Specifies a fixed number of VM instances. This must be a positive integer.
     *
     * Generated from protobuf field <code>optional int32 fixed = 97445748;</code>
     * @param int $var
     * @return $this
     */
    public function setFixed($var)
    {
        GPBUtil::checkInt32($var);
        $this->fixed = $var;

        return $this;
    }

    /**
     * Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
     *
     * Generated from protobuf field <code>optional int32 percent = 394814533;</code>
     * @return int
     */
    public function getPercent()
    {
        return isset($this->percent) ? $this->percent : 0;
    }

    public function hasPercent()
    {
        return isset($this->percent);
    }

    public function clearPercent()
    {
        unset($this->percent);
    }

    /**
     * Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.
     *
     * Generated from protobuf field <code>optional int32 percent = 394814533;</code>
     * @param int $var
     * @return $this
     */
    public function setPercent($var)
    {
        GPBUtil::checkInt32($var);
        $this->percent = $var;

        return $this;
    }

}

