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

namespace Google\Cloud\AppEngine\V1;

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

/**
 * A service with basic scaling will create an instance when the application
 * receives a request. The instance will be turned down when the app becomes
 * idle. Basic scaling is ideal for work that is intermittent or driven by
 * user activity.
 *
 * Generated from protobuf message <code>google.appengine.v1.BasicScaling</code>
 */
class BasicScaling extends \Google\Protobuf\Internal\Message
{
    /**
     * Duration of time after the last request that an instance must wait before
     * the instance is shut down.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration idle_timeout = 1;</code>
     */
    private $idle_timeout = null;
    /**
     * Maximum number of instances to create for this version.
     *
     * Generated from protobuf field <code>int32 max_instances = 2;</code>
     */
    private $max_instances = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Duration $idle_timeout
     *           Duration of time after the last request that an instance must wait before
     *           the instance is shut down.
     *     @type int $max_instances
     *           Maximum number of instances to create for this version.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Appengine\V1\Version::initOnce();
        parent::__construct($data);
    }

    /**
     * Duration of time after the last request that an instance must wait before
     * the instance is shut down.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration idle_timeout = 1;</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getIdleTimeout()
    {
        return $this->idle_timeout;
    }

    public function hasIdleTimeout()
    {
        return isset($this->idle_timeout);
    }

    public function clearIdleTimeout()
    {
        unset($this->idle_timeout);
    }

    /**
     * Duration of time after the last request that an instance must wait before
     * the instance is shut down.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration idle_timeout = 1;</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setIdleTimeout($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->idle_timeout = $var;

        return $this;
    }

    /**
     * Maximum number of instances to create for this version.
     *
     * Generated from protobuf field <code>int32 max_instances = 2;</code>
     * @return int
     */
    public function getMaxInstances()
    {
        return $this->max_instances;
    }

    /**
     * Maximum number of instances to create for this version.
     *
     * Generated from protobuf field <code>int32 max_instances = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setMaxInstances($var)
    {
        GPBUtil::checkInt32($var);
        $this->max_instances = $var;

        return $this;
    }

}

