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

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * (-- api-linter: core::0216::synonyms=disabled
 *     aip.dev/not-precedent: Call this status because it is . --)
 * Specify the drainage status for a Worker Deployment Version so users can decide whether they
 * can safely decommission the version.
 * Experimental. Worker Deployments are experimental and might significantly change in the future.
 *
 * Protobuf type <code>temporal.api.enums.v1.VersionDrainageStatus</code>
 */
class VersionDrainageStatus
{
    /**
     * Drainage Status is not specified.
     *
     * Generated from protobuf enum <code>VERSION_DRAINAGE_STATUS_UNSPECIFIED = 0;</code>
     */
    const VERSION_DRAINAGE_STATUS_UNSPECIFIED = 0;
    /**
     * The Worker Deployment Version is not used by new workflows but is still used by
     * open pinned workflows. The version cannot be decommissioned safely.
     *
     * Generated from protobuf enum <code>VERSION_DRAINAGE_STATUS_DRAINING = 1;</code>
     */
    const VERSION_DRAINAGE_STATUS_DRAINING = 1;
    /**
     * The Worker Deployment Version is not used by new or open workflows, but might be still needed by
     * Queries sent to closed workflows. The version can be decommissioned safely if user does
     * not query closed workflows. If the user does query closed workflows for some time x after
     * workflows are closed, they should decommission the version after it has been drained for that duration.
     *
     * Generated from protobuf enum <code>VERSION_DRAINAGE_STATUS_DRAINED = 2;</code>
     */
    const VERSION_DRAINAGE_STATUS_DRAINED = 2;

    private static $valueToName = [
        self::VERSION_DRAINAGE_STATUS_UNSPECIFIED => 'VERSION_DRAINAGE_STATUS_UNSPECIFIED',
        self::VERSION_DRAINAGE_STATUS_DRAINING => 'VERSION_DRAINAGE_STATUS_DRAINING',
        self::VERSION_DRAINAGE_STATUS_DRAINED => 'VERSION_DRAINAGE_STATUS_DRAINED',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

