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

namespace Google\Cloud\Config\V1;

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

/**
 * A DeploymentUnit is a container for a deployment and its dependencies.
 * An existing deployment can be provided directly in the unit, or the unit
 * can act as a placeholder to define the DAG, with the deployment specs
 * supplied in a `provisionDeploymentRequest`.
 *
 * Generated from protobuf message <code>google.cloud.config.v1.DeploymentUnit</code>
 */
class DeploymentUnit extends \Google\Protobuf\Internal\Message
{
    /**
     * The id of the deployment unit. Must be unique within the deployment group.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     */
    protected $id = '';
    /**
     * Optional. The name of the deployment to be provisioned.
     * Format:
     * 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
     *
     * Generated from protobuf field <code>optional string deployment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     */
    protected $deployment = null;
    /**
     * Required. The IDs of the deployment units within the deployment group that
     * this unit depends on.
     *
     * Generated from protobuf field <code>repeated string dependencies = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $dependencies;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $id
     *           The id of the deployment unit. Must be unique within the deployment group.
     *     @type string $deployment
     *           Optional. The name of the deployment to be provisioned.
     *           Format:
     *           'projects/{project_id}/locations/{location}/deployments/{deployment}'.
     *     @type string[] $dependencies
     *           Required. The IDs of the deployment units within the deployment group that
     *           this unit depends on.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Config\V1\Config::initOnce();
        parent::__construct($data);
    }

    /**
     * The id of the deployment unit. Must be unique within the deployment group.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * The id of the deployment unit. Must be unique within the deployment group.
     *
     * Generated from protobuf field <code>string id = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * Optional. The name of the deployment to be provisioned.
     * Format:
     * 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
     *
     * Generated from protobuf field <code>optional string deployment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getDeployment()
    {
        return isset($this->deployment) ? $this->deployment : '';
    }

    public function hasDeployment()
    {
        return isset($this->deployment);
    }

    public function clearDeployment()
    {
        unset($this->deployment);
    }

    /**
     * Optional. The name of the deployment to be provisioned.
     * Format:
     * 'projects/{project_id}/locations/{location}/deployments/{deployment}'.
     *
     * Generated from protobuf field <code>optional string deployment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setDeployment($var)
    {
        GPBUtil::checkString($var, True);
        $this->deployment = $var;

        return $this;
    }

    /**
     * Required. The IDs of the deployment units within the deployment group that
     * this unit depends on.
     *
     * Generated from protobuf field <code>repeated string dependencies = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return RepeatedField<string>
     */
    public function getDependencies()
    {
        return $this->dependencies;
    }

    /**
     * Required. The IDs of the deployment units within the deployment group that
     * this unit depends on.
     *
     * Generated from protobuf field <code>repeated string dependencies = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string[] $var
     * @return $this
     */
    public function setDependencies($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->dependencies = $arr;

        return $this;
    }

}

