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

namespace Google\Cloud\Deploy\V1;

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

/**
 * The `AdvanceRollout` automation rule will automatically advance a successful
 * Rollout to the next phase.
 *
 * Generated from protobuf message <code>google.cloud.deploy.v1.AdvanceRolloutRule</code>
 */
class AdvanceRolloutRule extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. ID of the rule. This id must be unique in the `Automation`
     * resource to which this rule belongs. The format is
     * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $id = '';
    /**
     * Optional. Proceeds only after phase name matched any one in the list.
     * This value must consist of lower-case letters, numbers, and hyphens,
     * start with a letter and end with a letter or a number, and have a max
     * length of 63 characters. In other words, it must match the following
     * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>repeated string source_phases = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $source_phases;
    /**
     * Optional. How long to wait after a rollout is finished.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration wait = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $wait = null;
    /**
     * Output only. Information around the state of the Automation rule.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.AutomationRuleCondition condition = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $condition = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $id
     *           Required. ID of the rule. This id must be unique in the `Automation`
     *           resource to which this rule belongs. The format is
     *           `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $source_phases
     *           Optional. Proceeds only after phase name matched any one in the list.
     *           This value must consist of lower-case letters, numbers, and hyphens,
     *           start with a letter and end with a letter or a number, and have a max
     *           length of 63 characters. In other words, it must match the following
     *           regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *     @type \Google\Protobuf\Duration $wait
     *           Optional. How long to wait after a rollout is finished.
     *     @type \Google\Cloud\Deploy\V1\AutomationRuleCondition $condition
     *           Output only. Information around the state of the Automation rule.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Deploy\V1\CloudDeploy::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. ID of the rule. This id must be unique in the `Automation`
     * resource to which this rule belongs. The format is
     * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Required. ID of the rule. This id must be unique in the `Automation`
     * resource to which this rule belongs. The format is
     * `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
     *
     * Generated from protobuf field <code>string id = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setId($var)
    {
        GPBUtil::checkString($var, True);
        $this->id = $var;

        return $this;
    }

    /**
     * Optional. Proceeds only after phase name matched any one in the list.
     * This value must consist of lower-case letters, numbers, and hyphens,
     * start with a letter and end with a letter or a number, and have a max
     * length of 63 characters. In other words, it must match the following
     * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>repeated string source_phases = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getSourcePhases()
    {
        return $this->source_phases;
    }

    /**
     * Optional. Proceeds only after phase name matched any one in the list.
     * This value must consist of lower-case letters, numbers, and hyphens,
     * start with a letter and end with a letter or a number, and have a max
     * length of 63 characters. In other words, it must match the following
     * regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
     *
     * Generated from protobuf field <code>repeated string source_phases = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setSourcePhases($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->source_phases = $arr;

        return $this;
    }

    /**
     * Optional. How long to wait after a rollout is finished.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration wait = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Duration|null
     */
    public function getWait()
    {
        return $this->wait;
    }

    public function hasWait()
    {
        return isset($this->wait);
    }

    public function clearWait()
    {
        unset($this->wait);
    }

    /**
     * Optional. How long to wait after a rollout is finished.
     *
     * Generated from protobuf field <code>.google.protobuf.Duration wait = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Protobuf\Duration $var
     * @return $this
     */
    public function setWait($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class);
        $this->wait = $var;

        return $this;
    }

    /**
     * Output only. Information around the state of the Automation rule.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.AutomationRuleCondition condition = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Cloud\Deploy\V1\AutomationRuleCondition|null
     */
    public function getCondition()
    {
        return $this->condition;
    }

    public function hasCondition()
    {
        return isset($this->condition);
    }

    public function clearCondition()
    {
        unset($this->condition);
    }

    /**
     * Output only. Information around the state of the Automation rule.
     *
     * Generated from protobuf field <code>.google.cloud.deploy.v1.AutomationRuleCondition condition = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Cloud\Deploy\V1\AutomationRuleCondition $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Deploy\V1\AutomationRuleCondition::class);
        $this->condition = $var;

        return $this;
    }

}

