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

namespace Google\Cloud\Run\V2\Condition;

use UnexpectedValueException;

/**
 * Reasons specific to Revision resource.
 *
 * Protobuf type <code>google.cloud.run.v2.Condition.RevisionReason</code>
 */
class RevisionReason
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>REVISION_REASON_UNDEFINED = 0;</code>
     */
    const REVISION_REASON_UNDEFINED = 0;
    /**
     * Revision in Pending state.
     *
     * Generated from protobuf enum <code>PENDING = 1;</code>
     */
    const PENDING = 1;
    /**
     * Revision is in Reserve state.
     *
     * Generated from protobuf enum <code>RESERVE = 2;</code>
     */
    const RESERVE = 2;
    /**
     * Revision is Retired.
     *
     * Generated from protobuf enum <code>RETIRED = 3;</code>
     */
    const RETIRED = 3;
    /**
     * Revision is being retired.
     *
     * Generated from protobuf enum <code>RETIRING = 4;</code>
     */
    const RETIRING = 4;
    /**
     * Revision is being recreated.
     *
     * Generated from protobuf enum <code>RECREATING = 5;</code>
     */
    const RECREATING = 5;
    /**
     * There was a health check error.
     *
     * Generated from protobuf enum <code>HEALTH_CHECK_CONTAINER_ERROR = 6;</code>
     */
    const HEALTH_CHECK_CONTAINER_ERROR = 6;
    /**
     * Health check failed due to user error from customized path of the
     * container. System will retry.
     *
     * Generated from protobuf enum <code>CUSTOMIZED_PATH_RESPONSE_PENDING = 7;</code>
     */
    const CUSTOMIZED_PATH_RESPONSE_PENDING = 7;
    /**
     * A revision with min_instance_count > 0 was created and is reserved, but
     * it was not configured to serve traffic, so it's not live. This can also
     * happen momentarily during traffic migration.
     *
     * Generated from protobuf enum <code>MIN_INSTANCES_NOT_PROVISIONED = 8;</code>
     */
    const MIN_INSTANCES_NOT_PROVISIONED = 8;
    /**
     * The maximum allowed number of active revisions has been reached.
     *
     * Generated from protobuf enum <code>ACTIVE_REVISION_LIMIT_REACHED = 9;</code>
     */
    const ACTIVE_REVISION_LIMIT_REACHED = 9;
    /**
     * There was no deployment defined.
     * This value is no longer used, but Services created in older versions of
     * the API might contain this value.
     *
     * Generated from protobuf enum <code>NO_DEPLOYMENT = 10;</code>
     */
    const NO_DEPLOYMENT = 10;
    /**
     * A revision's container has no port specified since the revision is of a
     * manually scaled service with 0 instance count
     *
     * Generated from protobuf enum <code>HEALTH_CHECK_SKIPPED = 11;</code>
     */
    const HEALTH_CHECK_SKIPPED = 11;

    private static $valueToName = [
        self::REVISION_REASON_UNDEFINED => 'REVISION_REASON_UNDEFINED',
        self::PENDING => 'PENDING',
        self::RESERVE => 'RESERVE',
        self::RETIRED => 'RETIRED',
        self::RETIRING => 'RETIRING',
        self::RECREATING => 'RECREATING',
        self::HEALTH_CHECK_CONTAINER_ERROR => 'HEALTH_CHECK_CONTAINER_ERROR',
        self::CUSTOMIZED_PATH_RESPONSE_PENDING => 'CUSTOMIZED_PATH_RESPONSE_PENDING',
        self::MIN_INSTANCES_NOT_PROVISIONED => 'MIN_INSTANCES_NOT_PROVISIONED',
        self::ACTIVE_REVISION_LIMIT_REACHED => 'ACTIVE_REVISION_LIMIT_REACHED',
        self::NO_DEPLOYMENT => 'NO_DEPLOYMENT',
        self::HEALTH_CHECK_SKIPPED => 'HEALTH_CHECK_SKIPPED',
    ];

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


