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

namespace Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace;

use UnexpectedValueException;

/**
 * Output only.
 * Defines an error reason code.
 * Next id: 7
 *
 * Protobuf type <code>google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace.Code</code>
 */
class Code
{
    /**
     * Default value is never used.
     *
     * Generated from protobuf enum <code>CODE_UNSPECIFIED = 0;</code>
     */
    const CODE_UNSPECIFIED = 0;
    /**
     * Indicates that the scan run failed due to an internal server error.
     *
     * Generated from protobuf enum <code>INTERNAL_ERROR = 1;</code>
     */
    const INTERNAL_ERROR = 1;
    /**
     * Indicates a scan configuration error, usually due to outdated ScanConfig
     * settings, such as starting_urls or the DNS configuration.
     *
     * Generated from protobuf enum <code>SCAN_CONFIG_ISSUE = 2;</code>
     */
    const SCAN_CONFIG_ISSUE = 2;
    /**
     * Indicates an authentication error, usually due to outdated ScanConfig
     * authentication settings.
     *
     * Generated from protobuf enum <code>AUTHENTICATION_CONFIG_ISSUE = 3;</code>
     */
    const AUTHENTICATION_CONFIG_ISSUE = 3;
    /**
     * Indicates a scan operation timeout, usually caused by a very large site.
     *
     * Generated from protobuf enum <code>TIMED_OUT_WHILE_SCANNING = 4;</code>
     */
    const TIMED_OUT_WHILE_SCANNING = 4;
    /**
     * Indicates that a scan encountered excessive redirects, either to
     * authentication or some other page outside of the scan scope.
     *
     * Generated from protobuf enum <code>TOO_MANY_REDIRECTS = 5;</code>
     */
    const TOO_MANY_REDIRECTS = 5;
    /**
     * Indicates that a scan encountered numerous errors from the web site
     * pages. When available, most_common_http_error_code field indicates the
     * most common HTTP error code encountered during the scan.
     *
     * Generated from protobuf enum <code>TOO_MANY_HTTP_ERRORS = 6;</code>
     */
    const TOO_MANY_HTTP_ERRORS = 6;

    private static $valueToName = [
        self::CODE_UNSPECIFIED => 'CODE_UNSPECIFIED',
        self::INTERNAL_ERROR => 'INTERNAL_ERROR',
        self::SCAN_CONFIG_ISSUE => 'SCAN_CONFIG_ISSUE',
        self::AUTHENTICATION_CONFIG_ISSUE => 'AUTHENTICATION_CONFIG_ISSUE',
        self::TIMED_OUT_WHILE_SCANNING => 'TIMED_OUT_WHILE_SCANNING',
        self::TOO_MANY_REDIRECTS => 'TOO_MANY_REDIRECTS',
        self::TOO_MANY_HTTP_ERRORS => 'TOO_MANY_HTTP_ERRORS',
    ];

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


