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

namespace Google\Cloud\CertificateManager\V1\Certificate\ManagedCertificate\AuthorizationAttemptInfo;

use UnexpectedValueException;

/**
 * State of the domain for managed certificate issuance.
 *
 * Protobuf type <code>google.cloud.certificatemanager.v1.Certificate.ManagedCertificate.AuthorizationAttemptInfo.State</code>
 */
class State
{
    /**
     * State is unspecified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Certificate provisioning for this domain is under way. Google Cloud
     * will attempt to authorize the domain.
     *
     * Generated from protobuf enum <code>AUTHORIZING = 1;</code>
     */
    const AUTHORIZING = 1;
    /**
     * A managed certificate can be provisioned, no issues for this domain.
     *
     * Generated from protobuf enum <code>AUTHORIZED = 6;</code>
     */
    const AUTHORIZED = 6;
    /**
     * Attempt to authorize the domain failed. This prevents the Managed
     * Certificate from being issued.
     * See `failure_reason` and `details` fields for more information.
     *
     * Generated from protobuf enum <code>FAILED = 7;</code>
     */
    const FAILED = 7;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::AUTHORIZING => 'AUTHORIZING',
        self::AUTHORIZED => 'AUTHORIZED',
        self::FAILED => 'FAILED',
    ];

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


