<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: temporal/api/deployment/v1/message.proto

namespace Temporal\Api\Deployment\V1;

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

/**
 * A Worker Deployment Version (Version, for short) represents all workers of the same 
 * code and config within a Deployment. Workers of the same Version are expected to 
 * behave exactly the same so when executions move between them there are no 
 * non-determinism issues.
 * Worker Deployment Versions are created in Temporal server automatically when 
 * their first poller arrives to the server.
 * Experimental. Worker Deployments are experimental and might significantly change in the future.
 *
 * Generated from protobuf message <code>temporal.api.deployment.v1.WorkerDeploymentVersionInfo</code>
 */
class WorkerDeploymentVersionInfo extends \Google\Protobuf\Internal\Message
{
    /**
     * Deprecated. Use `deployment_version`.
     *
     * Generated from protobuf field <code>string version = 1 [deprecated = true];</code>
     * @deprecated
     */
    protected $version = '';
    /**
     * The status of the Worker Deployment Version.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.WorkerDeploymentVersionStatus status = 14;</code>
     */
    protected $status = 0;
    /**
     * Required.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 11;</code>
     */
    protected $deployment_version = null;
    /**
     * Generated from protobuf field <code>string deployment_name = 2;</code>
     */
    protected $deployment_name = '';
    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     */
    protected $create_time = null;
    /**
     * Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp routing_changed_time = 4;</code>
     */
    protected $routing_changed_time = null;
    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not current.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp current_since_time = 5;</code>
     */
    protected $current_since_time = null;
    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp ramping_since_time = 6;</code>
     */
    protected $ramping_since_time = null;
    /**
     * Timestamp when this version first became current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp first_activation_time = 12;</code>
     */
    protected $first_activation_time = null;
    /**
     * Timestamp when this version last stopped being current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_deactivation_time = 13;</code>
     */
    protected $last_deactivation_time = null;
    /**
     * Range: [0, 100]. Must be zero if the version is not ramping (i.e. `ramping_since_time` is nil).
     * Can be in the range [0, 100] if the version is ramping.
     *
     * Generated from protobuf field <code>float ramp_percentage = 7;</code>
     */
    protected $ramp_percentage = 0.0;
    /**
     * All the Task Queues that have ever polled from this Deployment version.
     * Deprecated. Use `version_task_queues` in DescribeWorkerDeploymentVersionResponse instead.
     *
     * Generated from protobuf field <code>repeated .temporal.api.deployment.v1.WorkerDeploymentVersionInfo.VersionTaskQueueInfo task_queue_infos = 8;</code>
     */
    private $task_queue_infos;
    /**
     * Helps user determine when it is safe to decommission the workers of this
     * Version. Not present when version is current or ramping.
     * Current limitations:
     * - Not supported for Unversioned mode.
     * - Periodically refreshed, may have delays up to few minutes (consult the
     *   last_checked_time value).
     * - Refreshed only when version is not current or ramping AND the status is not
     *   "drained" yet.
     * - Once the status is changed to "drained", it is not changed until the Version
     *   becomes Current or Ramping again, at which time the drainage info is cleared.
     *   This means if the Version is "drained" but new workflows are sent to it via
     *   Pinned Versioning Override, the status does not account for those Pinned-override
     *   executions and remains "drained".
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionDrainageInfo drainage_info = 9;</code>
     */
    protected $drainage_info = null;
    /**
     * Arbitrary user-provided metadata attached to this version.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionMetadata metadata = 10;</code>
     */
    protected $metadata = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $version
     *           Deprecated. Use `deployment_version`.
     *     @type int $status
     *           The status of the Worker Deployment Version.
     *     @type \Temporal\Api\Deployment\V1\WorkerDeploymentVersion $deployment_version
     *           Required.
     *     @type string $deployment_name
     *     @type \Google\Protobuf\Timestamp $create_time
     *     @type \Google\Protobuf\Timestamp $routing_changed_time
     *           Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
     *     @type \Google\Protobuf\Timestamp $current_since_time
     *           (-- api-linter: core::0140::prepositions=disabled
     *               aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     *           Unset if not current.
     *     @type \Google\Protobuf\Timestamp $ramping_since_time
     *           (-- api-linter: core::0140::prepositions=disabled
     *               aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     *           Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
     *     @type \Google\Protobuf\Timestamp $first_activation_time
     *           Timestamp when this version first became current or ramping.
     *     @type \Google\Protobuf\Timestamp $last_deactivation_time
     *           Timestamp when this version last stopped being current or ramping.
     *     @type float $ramp_percentage
     *           Range: [0, 100]. Must be zero if the version is not ramping (i.e. `ramping_since_time` is nil).
     *           Can be in the range [0, 100] if the version is ramping.
     *     @type \Temporal\Api\Deployment\V1\WorkerDeploymentVersionInfo\VersionTaskQueueInfo[] $task_queue_infos
     *           All the Task Queues that have ever polled from this Deployment version.
     *           Deprecated. Use `version_task_queues` in DescribeWorkerDeploymentVersionResponse instead.
     *     @type \Temporal\Api\Deployment\V1\VersionDrainageInfo $drainage_info
     *           Helps user determine when it is safe to decommission the workers of this
     *           Version. Not present when version is current or ramping.
     *           Current limitations:
     *           - Not supported for Unversioned mode.
     *           - Periodically refreshed, may have delays up to few minutes (consult the
     *             last_checked_time value).
     *           - Refreshed only when version is not current or ramping AND the status is not
     *             "drained" yet.
     *           - Once the status is changed to "drained", it is not changed until the Version
     *             becomes Current or Ramping again, at which time the drainage info is cleared.
     *             This means if the Version is "drained" but new workflows are sent to it via
     *             Pinned Versioning Override, the status does not account for those Pinned-override
     *             executions and remains "drained".
     *     @type \Temporal\Api\Deployment\V1\VersionMetadata $metadata
     *           Arbitrary user-provided metadata attached to this version.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\Deployment\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * Deprecated. Use `deployment_version`.
     *
     * Generated from protobuf field <code>string version = 1 [deprecated = true];</code>
     * @return string
     * @deprecated
     */
    public function getVersion()
    {
        if ($this->version !== '') {
            @trigger_error('version is deprecated.', E_USER_DEPRECATED);
        }
        return $this->version;
    }

    /**
     * Deprecated. Use `deployment_version`.
     *
     * Generated from protobuf field <code>string version = 1 [deprecated = true];</code>
     * @param string $var
     * @return $this
     * @deprecated
     */
    public function setVersion($var)
    {
        @trigger_error('version is deprecated.', E_USER_DEPRECATED);
        GPBUtil::checkString($var, True);
        $this->version = $var;

        return $this;
    }

    /**
     * The status of the Worker Deployment Version.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.WorkerDeploymentVersionStatus status = 14;</code>
     * @return int
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * The status of the Worker Deployment Version.
     *
     * Generated from protobuf field <code>.temporal.api.enums.v1.WorkerDeploymentVersionStatus status = 14;</code>
     * @param int $var
     * @return $this
     */
    public function setStatus($var)
    {
        GPBUtil::checkEnum($var, \Temporal\Api\Enums\V1\WorkerDeploymentVersionStatus::class);
        $this->status = $var;

        return $this;
    }

    /**
     * Required.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 11;</code>
     * @return \Temporal\Api\Deployment\V1\WorkerDeploymentVersion|null
     */
    public function getDeploymentVersion()
    {
        return $this->deployment_version;
    }

    public function hasDeploymentVersion()
    {
        return isset($this->deployment_version);
    }

    public function clearDeploymentVersion()
    {
        unset($this->deployment_version);
    }

    /**
     * Required.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 11;</code>
     * @param \Temporal\Api\Deployment\V1\WorkerDeploymentVersion $var
     * @return $this
     */
    public function setDeploymentVersion($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Deployment\V1\WorkerDeploymentVersion::class);
        $this->deployment_version = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>string deployment_name = 2;</code>
     * @return string
     */
    public function getDeploymentName()
    {
        return $this->deployment_name;
    }

    /**
     * Generated from protobuf field <code>string deployment_name = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setDeploymentName($var)
    {
        GPBUtil::checkString($var, True);
        $this->deployment_name = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp routing_changed_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getRoutingChangedTime()
    {
        return $this->routing_changed_time;
    }

    public function hasRoutingChangedTime()
    {
        return isset($this->routing_changed_time);
    }

    public function clearRoutingChangedTime()
    {
        unset($this->routing_changed_time);
    }

    /**
     * Last time `current_since_time`, `ramping_since_time, or `ramp_percentage` of this version changed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp routing_changed_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setRoutingChangedTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->routing_changed_time = $var;

        return $this;
    }

    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not current.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp current_since_time = 5;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCurrentSinceTime()
    {
        return $this->current_since_time;
    }

    public function hasCurrentSinceTime()
    {
        return isset($this->current_since_time);
    }

    public function clearCurrentSinceTime()
    {
        unset($this->current_since_time);
    }

    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not current.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp current_since_time = 5;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCurrentSinceTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->current_since_time = $var;

        return $this;
    }

    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp ramping_since_time = 6;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getRampingSinceTime()
    {
        return $this->ramping_since_time;
    }

    public function hasRampingSinceTime()
    {
        return isset($this->ramping_since_time);
    }

    public function clearRampingSinceTime()
    {
        unset($this->ramping_since_time);
    }

    /**
     * (-- api-linter: core::0140::prepositions=disabled
     *     aip.dev/not-precedent: 'Since' captures the field semantics despite being a preposition. --)
     * Unset if not ramping. Updated when the version first starts ramping, not on each ramp change.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp ramping_since_time = 6;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setRampingSinceTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->ramping_since_time = $var;

        return $this;
    }

    /**
     * Timestamp when this version first became current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp first_activation_time = 12;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getFirstActivationTime()
    {
        return $this->first_activation_time;
    }

    public function hasFirstActivationTime()
    {
        return isset($this->first_activation_time);
    }

    public function clearFirstActivationTime()
    {
        unset($this->first_activation_time);
    }

    /**
     * Timestamp when this version first became current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp first_activation_time = 12;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setFirstActivationTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->first_activation_time = $var;

        return $this;
    }

    /**
     * Timestamp when this version last stopped being current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_deactivation_time = 13;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getLastDeactivationTime()
    {
        return $this->last_deactivation_time;
    }

    public function hasLastDeactivationTime()
    {
        return isset($this->last_deactivation_time);
    }

    public function clearLastDeactivationTime()
    {
        unset($this->last_deactivation_time);
    }

    /**
     * Timestamp when this version last stopped being current or ramping.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp last_deactivation_time = 13;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setLastDeactivationTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->last_deactivation_time = $var;

        return $this;
    }

    /**
     * Range: [0, 100]. Must be zero if the version is not ramping (i.e. `ramping_since_time` is nil).
     * Can be in the range [0, 100] if the version is ramping.
     *
     * Generated from protobuf field <code>float ramp_percentage = 7;</code>
     * @return float
     */
    public function getRampPercentage()
    {
        return $this->ramp_percentage;
    }

    /**
     * Range: [0, 100]. Must be zero if the version is not ramping (i.e. `ramping_since_time` is nil).
     * Can be in the range [0, 100] if the version is ramping.
     *
     * Generated from protobuf field <code>float ramp_percentage = 7;</code>
     * @param float $var
     * @return $this
     */
    public function setRampPercentage($var)
    {
        GPBUtil::checkFloat($var);
        $this->ramp_percentage = $var;

        return $this;
    }

    /**
     * All the Task Queues that have ever polled from this Deployment version.
     * Deprecated. Use `version_task_queues` in DescribeWorkerDeploymentVersionResponse instead.
     *
     * Generated from protobuf field <code>repeated .temporal.api.deployment.v1.WorkerDeploymentVersionInfo.VersionTaskQueueInfo task_queue_infos = 8;</code>
     * @return RepeatedField<\Temporal\Api\Deployment\V1\WorkerDeploymentVersionInfo\VersionTaskQueueInfo>
     */
    public function getTaskQueueInfos()
    {
        return $this->task_queue_infos;
    }

    /**
     * All the Task Queues that have ever polled from this Deployment version.
     * Deprecated. Use `version_task_queues` in DescribeWorkerDeploymentVersionResponse instead.
     *
     * Generated from protobuf field <code>repeated .temporal.api.deployment.v1.WorkerDeploymentVersionInfo.VersionTaskQueueInfo task_queue_infos = 8;</code>
     * @param \Temporal\Api\Deployment\V1\WorkerDeploymentVersionInfo\VersionTaskQueueInfo[] $var
     * @return $this
     */
    public function setTaskQueueInfos($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Temporal\Api\Deployment\V1\WorkerDeploymentVersionInfo\VersionTaskQueueInfo::class);
        $this->task_queue_infos = $arr;

        return $this;
    }

    /**
     * Helps user determine when it is safe to decommission the workers of this
     * Version. Not present when version is current or ramping.
     * Current limitations:
     * - Not supported for Unversioned mode.
     * - Periodically refreshed, may have delays up to few minutes (consult the
     *   last_checked_time value).
     * - Refreshed only when version is not current or ramping AND the status is not
     *   "drained" yet.
     * - Once the status is changed to "drained", it is not changed until the Version
     *   becomes Current or Ramping again, at which time the drainage info is cleared.
     *   This means if the Version is "drained" but new workflows are sent to it via
     *   Pinned Versioning Override, the status does not account for those Pinned-override
     *   executions and remains "drained".
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionDrainageInfo drainage_info = 9;</code>
     * @return \Temporal\Api\Deployment\V1\VersionDrainageInfo|null
     */
    public function getDrainageInfo()
    {
        return $this->drainage_info;
    }

    public function hasDrainageInfo()
    {
        return isset($this->drainage_info);
    }

    public function clearDrainageInfo()
    {
        unset($this->drainage_info);
    }

    /**
     * Helps user determine when it is safe to decommission the workers of this
     * Version. Not present when version is current or ramping.
     * Current limitations:
     * - Not supported for Unversioned mode.
     * - Periodically refreshed, may have delays up to few minutes (consult the
     *   last_checked_time value).
     * - Refreshed only when version is not current or ramping AND the status is not
     *   "drained" yet.
     * - Once the status is changed to "drained", it is not changed until the Version
     *   becomes Current or Ramping again, at which time the drainage info is cleared.
     *   This means if the Version is "drained" but new workflows are sent to it via
     *   Pinned Versioning Override, the status does not account for those Pinned-override
     *   executions and remains "drained".
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionDrainageInfo drainage_info = 9;</code>
     * @param \Temporal\Api\Deployment\V1\VersionDrainageInfo $var
     * @return $this
     */
    public function setDrainageInfo($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Deployment\V1\VersionDrainageInfo::class);
        $this->drainage_info = $var;

        return $this;
    }

    /**
     * Arbitrary user-provided metadata attached to this version.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionMetadata metadata = 10;</code>
     * @return \Temporal\Api\Deployment\V1\VersionMetadata|null
     */
    public function getMetadata()
    {
        return $this->metadata;
    }

    public function hasMetadata()
    {
        return isset($this->metadata);
    }

    public function clearMetadata()
    {
        unset($this->metadata);
    }

    /**
     * Arbitrary user-provided metadata attached to this version.
     *
     * Generated from protobuf field <code>.temporal.api.deployment.v1.VersionMetadata metadata = 10;</code>
     * @param \Temporal\Api\Deployment\V1\VersionMetadata $var
     * @return $this
     */
    public function setMetadata($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Deployment\V1\VersionMetadata::class);
        $this->metadata = $var;

        return $this;
    }

}

