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

namespace Google\Cloud\RecaptchaEnterprise\V1\RiskAnalysis;

use UnexpectedValueException;

/**
 * Challenge information for SCORE_AND_CHALLENGE and INVISIBLE keys
 *
 * Protobuf type <code>google.cloud.recaptchaenterprise.v1.RiskAnalysis.Challenge</code>
 */
class Challenge
{
    /**
     * Default unspecified type.
     *
     * Generated from protobuf enum <code>CHALLENGE_UNSPECIFIED = 0;</code>
     */
    const CHALLENGE_UNSPECIFIED = 0;
    /**
     * No challenge was presented for solving.
     *
     * Generated from protobuf enum <code>NOCAPTCHA = 1;</code>
     */
    const NOCAPTCHA = 1;
    /**
     * A solution was submitted that was correct.
     *
     * Generated from protobuf enum <code>PASSED = 2;</code>
     */
    const PASSED = 2;
    /**
     * A solution was submitted that was incorrect or otherwise
     * deemed suspicious.
     *
     * Generated from protobuf enum <code>FAILED = 3;</code>
     */
    const FAILED = 3;

    private static $valueToName = [
        self::CHALLENGE_UNSPECIFIED => 'CHALLENGE_UNSPECIFIED',
        self::NOCAPTCHA => 'NOCAPTCHA',
        self::PASSED => 'PASSED',
        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);
    }
}

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

