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

namespace Google\Cloud\RecaptchaEnterprise\V1\TestingOptions;

use UnexpectedValueException;

/**
 * Enum that represents the challenge option for challenge-based (CHECKBOX,
 * INVISIBLE) testing keys.
 *
 * Protobuf type <code>google.cloud.recaptchaenterprise.v1.TestingOptions.TestingChallenge</code>
 */
class TestingChallenge
{
    /**
     * Perform the normal risk analysis and return either nocaptcha or a
     * challenge depending on risk and trust factors.
     *
     * Generated from protobuf enum <code>TESTING_CHALLENGE_UNSPECIFIED = 0;</code>
     */
    const TESTING_CHALLENGE_UNSPECIFIED = 0;
    /**
     * Challenge requests for this key always return a nocaptcha, which
     * does not require a solution.
     *
     * Generated from protobuf enum <code>NOCAPTCHA = 1;</code>
     */
    const NOCAPTCHA = 1;
    /**
     * Challenge requests for this key always return an unsolvable
     * challenge.
     *
     * Generated from protobuf enum <code>UNSOLVABLE_CHALLENGE = 2;</code>
     */
    const UNSOLVABLE_CHALLENGE = 2;

    private static $valueToName = [
        self::TESTING_CHALLENGE_UNSPECIFIED => 'TESTING_CHALLENGE_UNSPECIFIED',
        self::NOCAPTCHA => 'NOCAPTCHA',
        self::UNSOLVABLE_CHALLENGE => 'UNSOLVABLE_CHALLENGE',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TestingChallenge::class, \Google\Cloud\RecaptchaEnterprise\V1\TestingOptions_TestingChallenge::class);

