<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/run/v2/vendor_settings.proto

namespace Google\Cloud\Run\V2;

use UnexpectedValueException;

/**
 * Alternatives for execution environments.
 *
 * Protobuf type <code>google.cloud.run.v2.ExecutionEnvironment</code>
 */
class ExecutionEnvironment
{
    /**
     * Unspecified
     *
     * Generated from protobuf enum <code>EXECUTION_ENVIRONMENT_UNSPECIFIED = 0;</code>
     */
    const EXECUTION_ENVIRONMENT_UNSPECIFIED = 0;
    /**
     * Uses the First Generation environment.
     *
     * Generated from protobuf enum <code>EXECUTION_ENVIRONMENT_GEN1 = 1;</code>
     */
    const EXECUTION_ENVIRONMENT_GEN1 = 1;
    /**
     * Uses Second Generation environment.
     *
     * Generated from protobuf enum <code>EXECUTION_ENVIRONMENT_GEN2 = 2;</code>
     */
    const EXECUTION_ENVIRONMENT_GEN2 = 2;

    private static $valueToName = [
        self::EXECUTION_ENVIRONMENT_UNSPECIFIED => 'EXECUTION_ENVIRONMENT_UNSPECIFIED',
        self::EXECUTION_ENVIRONMENT_GEN1 => 'EXECUTION_ENVIRONMENT_GEN1',
        self::EXECUTION_ENVIRONMENT_GEN2 => 'EXECUTION_ENVIRONMENT_GEN2',
    ];

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

