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

namespace Google\Cloud\CertificateManager\V1;

use UnexpectedValueException;

/**
 * Defines set of serving states associated with a resource.
 *
 * Protobuf type <code>google.cloud.certificatemanager.v1.ServingState</code>
 */
class ServingState
{
    /**
     * The status is undefined.
     *
     * Generated from protobuf enum <code>SERVING_STATE_UNSPECIFIED = 0;</code>
     */
    const SERVING_STATE_UNSPECIFIED = 0;
    /**
     * The configuration is serving.
     *
     * Generated from protobuf enum <code>ACTIVE = 1;</code>
     */
    const ACTIVE = 1;
    /**
     * Update is in progress. Some frontends may serve this configuration.
     *
     * Generated from protobuf enum <code>PENDING = 2;</code>
     */
    const PENDING = 2;

    private static $valueToName = [
        self::SERVING_STATE_UNSPECIFIED => 'SERVING_STATE_UNSPECIFIED',
        self::ACTIVE => 'ACTIVE',
        self::PENDING => 'PENDING',
    ];

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

