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

namespace Google\Cloud\Functions\V1;

use UnexpectedValueException;

/**
 * Describes the current stage of a deployment.
 *
 * Protobuf type <code>google.cloud.functions.v1.CloudFunctionStatus</code>
 */
class CloudFunctionStatus
{
    /**
     * Not specified. Invalid state.
     *
     * Generated from protobuf enum <code>CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0;</code>
     */
    const CLOUD_FUNCTION_STATUS_UNSPECIFIED = 0;
    /**
     * Function has been successfully deployed and is serving.
     *
     * Generated from protobuf enum <code>ACTIVE = 1;</code>
     */
    const ACTIVE = 1;
    /**
     * Function deployment failed and the function isn’t serving.
     *
     * Generated from protobuf enum <code>OFFLINE = 2;</code>
     */
    const OFFLINE = 2;
    /**
     * Function is being created or updated.
     *
     * Generated from protobuf enum <code>DEPLOY_IN_PROGRESS = 3;</code>
     */
    const DEPLOY_IN_PROGRESS = 3;
    /**
     * Function is being deleted.
     *
     * Generated from protobuf enum <code>DELETE_IN_PROGRESS = 4;</code>
     */
    const DELETE_IN_PROGRESS = 4;
    /**
     * Function deployment failed and the function serving state is undefined.
     * The function should be updated or deleted to move it out of this state.
     *
     * Generated from protobuf enum <code>UNKNOWN = 5;</code>
     */
    const UNKNOWN = 5;

    private static $valueToName = [
        self::CLOUD_FUNCTION_STATUS_UNSPECIFIED => 'CLOUD_FUNCTION_STATUS_UNSPECIFIED',
        self::ACTIVE => 'ACTIVE',
        self::OFFLINE => 'OFFLINE',
        self::DEPLOY_IN_PROGRESS => 'DEPLOY_IN_PROGRESS',
        self::DELETE_IN_PROGRESS => 'DELETE_IN_PROGRESS',
        self::UNKNOWN => 'UNKNOWN',
    ];

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

