<?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 POLICY_BASED_CHALLENGE and INVISIBLE keys.
 * Ensure that applications can handle values not explicitly listed.
 *
 * 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);
    }
}


