<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/dataflow/v1beta3/environment.proto

namespace Google\Cloud\Dataflow\V1beta3;

use UnexpectedValueException;

/**
 * Specifies what happens to a resource when a Cloud Dataflow
 * [google.dataflow.v1beta3.Job][google.dataflow.v1beta3.Job] has completed.
 *
 * Protobuf type <code>google.dataflow.v1beta3.TeardownPolicy</code>
 */
class TeardownPolicy
{
    /**
     * The teardown policy isn't specified, or is unknown.
     *
     * Generated from protobuf enum <code>TEARDOWN_POLICY_UNKNOWN = 0;</code>
     */
    const TEARDOWN_POLICY_UNKNOWN = 0;
    /**
     * Always teardown the resource.
     *
     * Generated from protobuf enum <code>TEARDOWN_ALWAYS = 1;</code>
     */
    const TEARDOWN_ALWAYS = 1;
    /**
     * Teardown the resource on success. This is useful for debugging
     * failures.
     *
     * Generated from protobuf enum <code>TEARDOWN_ON_SUCCESS = 2;</code>
     */
    const TEARDOWN_ON_SUCCESS = 2;
    /**
     * Never teardown the resource. This is useful for debugging and
     * development.
     *
     * Generated from protobuf enum <code>TEARDOWN_NEVER = 3;</code>
     */
    const TEARDOWN_NEVER = 3;

    private static $valueToName = [
        self::TEARDOWN_POLICY_UNKNOWN => 'TEARDOWN_POLICY_UNKNOWN',
        self::TEARDOWN_ALWAYS => 'TEARDOWN_ALWAYS',
        self::TEARDOWN_ON_SUCCESS => 'TEARDOWN_ON_SUCCESS',
        self::TEARDOWN_NEVER => 'TEARDOWN_NEVER',
    ];

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

