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

namespace Google\Cloud\WebSecurityScanner\V1beta\ScanRun;

use UnexpectedValueException;

/**
 * Types of ScanRun result state.
 *
 * Protobuf type <code>google.cloud.websecurityscanner.v1beta.ScanRun.ResultState</code>
 */
class ResultState
{
    /**
     * Default value. This value is returned when the ScanRun is not yet
     * finished.
     *
     * Generated from protobuf enum <code>RESULT_STATE_UNSPECIFIED = 0;</code>
     */
    const RESULT_STATE_UNSPECIFIED = 0;
    /**
     * The scan finished without errors.
     *
     * Generated from protobuf enum <code>SUCCESS = 1;</code>
     */
    const SUCCESS = 1;
    /**
     * The scan finished with errors.
     *
     * Generated from protobuf enum <code>ERROR = 2;</code>
     */
    const ERROR = 2;
    /**
     * The scan was terminated by user.
     *
     * Generated from protobuf enum <code>KILLED = 3;</code>
     */
    const KILLED = 3;

    private static $valueToName = [
        self::RESULT_STATE_UNSPECIFIED => 'RESULT_STATE_UNSPECIFIED',
        self::SUCCESS => 'SUCCESS',
        self::ERROR => 'ERROR',
        self::KILLED => 'KILLED',
    ];

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


