<?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;

/**
 * Reason for failure of the authorization attempt for the domain.
 *
 * Protobuf type <code>google.cloud.certificatemanager.v1.Certificate.ManagedCertificate.AuthorizationAttemptInfo.FailureReason</code>
 */
class FailureReason
{
    /**
     * FailureReason is unspecified.
     *
     * Generated from protobuf enum <code>FAILURE_REASON_UNSPECIFIED = 0;</code>
     */
    const FAILURE_REASON_UNSPECIFIED = 0;
    /**
     * There was a problem with the user's DNS or load balancer
     * configuration for this domain.
     *
     * Generated from protobuf enum <code>CONFIG = 1;</code>
     */
    const CONFIG = 1;
    /**
     * Certificate issuance forbidden by an explicit CAA record for the
     * domain or a failure to check CAA records for the domain.
     *
     * Generated from protobuf enum <code>CAA = 2;</code>
     */
    const CAA = 2;
    /**
     * Reached a CA or internal rate-limit for the domain,
     * e.g. for certificates per top-level private domain.
     *
     * Generated from protobuf enum <code>RATE_LIMITED = 3;</code>
     */
    const RATE_LIMITED = 3;

    private static $valueToName = [
        self::FAILURE_REASON_UNSPECIFIED => 'FAILURE_REASON_UNSPECIFIED',
        self::CONFIG => 'CONFIG',
        self::CAA => 'CAA',
        self::RATE_LIMITED => 'RATE_LIMITED',
    ];

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


