<?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;

/**
 * Specify the reachability level for a deployment so users can decide if it is time to
 * decommission the deployment.
 *
 * Protobuf type <code>temporal.api.enums.v1.DeploymentReachability</code>
 */
class DeploymentReachability
{
    /**
     * Reachability level is not specified.
     *
     * Generated from protobuf enum <code>DEPLOYMENT_REACHABILITY_UNSPECIFIED = 0;</code>
     */
    const DEPLOYMENT_REACHABILITY_UNSPECIFIED = 0;
    /**
     * The deployment is reachable by new and/or open workflows. The deployment cannot be
     * decommissioned safely.
     *
     * Generated from protobuf enum <code>DEPLOYMENT_REACHABILITY_REACHABLE = 1;</code>
     */
    const DEPLOYMENT_REACHABILITY_REACHABLE = 1;
    /**
     * The deployment is not reachable by new or open workflows, but might be still needed by
     * Queries sent to closed workflows. The deployment can be decommissioned safely if user does
     * not query closed workflows.
     *
     * Generated from protobuf enum <code>DEPLOYMENT_REACHABILITY_CLOSED_WORKFLOWS_ONLY = 2;</code>
     */
    const DEPLOYMENT_REACHABILITY_CLOSED_WORKFLOWS_ONLY = 2;
    /**
     * The deployment is not reachable by any workflow because all the workflows who needed this
     * deployment went out of retention period. The deployment can be decommissioned safely.
     *
     * Generated from protobuf enum <code>DEPLOYMENT_REACHABILITY_UNREACHABLE = 3;</code>
     */
    const DEPLOYMENT_REACHABILITY_UNREACHABLE = 3;

    private static $valueToName = [
        self::DEPLOYMENT_REACHABILITY_UNSPECIFIED => 'DEPLOYMENT_REACHABILITY_UNSPECIFIED',
        self::DEPLOYMENT_REACHABILITY_REACHABLE => 'DEPLOYMENT_REACHABILITY_REACHABLE',
        self::DEPLOYMENT_REACHABILITY_CLOSED_WORKFLOWS_ONLY => 'DEPLOYMENT_REACHABILITY_CLOSED_WORKFLOWS_ONLY',
        self::DEPLOYMENT_REACHABILITY_UNREACHABLE => 'DEPLOYMENT_REACHABILITY_UNREACHABLE',
    ];

    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);
    }
}

