<?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 common to all types of conditions.
 *
 * Protobuf type <code>google.cloud.run.v2.Condition.CommonReason</code>
 */
class CommonReason
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>COMMON_REASON_UNDEFINED = 0;</code>
     */
    const COMMON_REASON_UNDEFINED = 0;
    /**
     * Reason unknown. Further details will be in message.
     *
     * Generated from protobuf enum <code>UNKNOWN = 1;</code>
     */
    const UNKNOWN = 1;
    /**
     * Revision creation process failed.
     *
     * Generated from protobuf enum <code>REVISION_FAILED = 3;</code>
     */
    const REVISION_FAILED = 3;
    /**
     * Timed out waiting for completion.
     *
     * Generated from protobuf enum <code>PROGRESS_DEADLINE_EXCEEDED = 4;</code>
     */
    const PROGRESS_DEADLINE_EXCEEDED = 4;
    /**
     * The container image path is incorrect.
     *
     * Generated from protobuf enum <code>CONTAINER_MISSING = 6;</code>
     */
    const CONTAINER_MISSING = 6;
    /**
     * Insufficient permissions on the container image.
     *
     * Generated from protobuf enum <code>CONTAINER_PERMISSION_DENIED = 7;</code>
     */
    const CONTAINER_PERMISSION_DENIED = 7;
    /**
     * Container image is not authorized by policy.
     *
     * Generated from protobuf enum <code>CONTAINER_IMAGE_UNAUTHORIZED = 8;</code>
     */
    const CONTAINER_IMAGE_UNAUTHORIZED = 8;
    /**
     * Container image policy authorization check failed.
     *
     * Generated from protobuf enum <code>CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED = 9;</code>
     */
    const CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED = 9;
    /**
     * Insufficient permissions on encryption key.
     *
     * Generated from protobuf enum <code>ENCRYPTION_KEY_PERMISSION_DENIED = 10;</code>
     */
    const ENCRYPTION_KEY_PERMISSION_DENIED = 10;
    /**
     * Permission check on encryption key failed.
     *
     * Generated from protobuf enum <code>ENCRYPTION_KEY_CHECK_FAILED = 11;</code>
     */
    const ENCRYPTION_KEY_CHECK_FAILED = 11;
    /**
     * At least one Access check on secrets failed.
     *
     * Generated from protobuf enum <code>SECRETS_ACCESS_CHECK_FAILED = 12;</code>
     */
    const SECRETS_ACCESS_CHECK_FAILED = 12;
    /**
     * Waiting for operation to complete.
     *
     * Generated from protobuf enum <code>WAITING_FOR_OPERATION = 13;</code>
     */
    const WAITING_FOR_OPERATION = 13;
    /**
     * System will retry immediately.
     *
     * Generated from protobuf enum <code>IMMEDIATE_RETRY = 14;</code>
     */
    const IMMEDIATE_RETRY = 14;
    /**
     * System will retry later; current attempt failed.
     *
     * Generated from protobuf enum <code>POSTPONED_RETRY = 15;</code>
     */
    const POSTPONED_RETRY = 15;
    /**
     * An internal error occurred. Further information may be in the message.
     *
     * Generated from protobuf enum <code>INTERNAL = 16;</code>
     */
    const INTERNAL = 16;

    private static $valueToName = [
        self::COMMON_REASON_UNDEFINED => 'COMMON_REASON_UNDEFINED',
        self::UNKNOWN => 'UNKNOWN',
        self::REVISION_FAILED => 'REVISION_FAILED',
        self::PROGRESS_DEADLINE_EXCEEDED => 'PROGRESS_DEADLINE_EXCEEDED',
        self::CONTAINER_MISSING => 'CONTAINER_MISSING',
        self::CONTAINER_PERMISSION_DENIED => 'CONTAINER_PERMISSION_DENIED',
        self::CONTAINER_IMAGE_UNAUTHORIZED => 'CONTAINER_IMAGE_UNAUTHORIZED',
        self::CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED => 'CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED',
        self::ENCRYPTION_KEY_PERMISSION_DENIED => 'ENCRYPTION_KEY_PERMISSION_DENIED',
        self::ENCRYPTION_KEY_CHECK_FAILED => 'ENCRYPTION_KEY_CHECK_FAILED',
        self::SECRETS_ACCESS_CHECK_FAILED => 'SECRETS_ACCESS_CHECK_FAILED',
        self::WAITING_FOR_OPERATION => 'WAITING_FOR_OPERATION',
        self::IMMEDIATE_RETRY => 'IMMEDIATE_RETRY',
        self::POSTPONED_RETRY => 'POSTPONED_RETRY',
        self::INTERNAL => 'INTERNAL',
    ];

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


