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

namespace Google\Cloud\WebSecurityScanner\V1beta;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A ScanRun is a output-only resource representing an actual run of the scan.
 * Next id: 12
 *
 * Generated from protobuf message <code>google.cloud.websecurityscanner.v1beta.ScanRun</code>
 */
class ScanRun extends \Google\Protobuf\Internal\Message
{
    /**
     * The resource name of the ScanRun. The name follows the format of
     * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
     * The ScanRun IDs are generated by the system.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The execution state of the ScanRun.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2;</code>
     */
    private $execution_state = 0;
    /**
     * The result state of the ScanRun. This field is only available after the
     * execution state reaches "FINISHED".
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3;</code>
     */
    private $result_state = 0;
    /**
     * The time at which the ScanRun started.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 4;</code>
     */
    private $start_time = null;
    /**
     * The time at which the ScanRun reached termination state - that the ScanRun
     * is either finished or stopped by user.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 5;</code>
     */
    private $end_time = null;
    /**
     * The number of URLs crawled during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs crawled up to now.
     *
     * Generated from protobuf field <code>int64 urls_crawled_count = 6;</code>
     */
    private $urls_crawled_count = 0;
    /**
     * The number of URLs tested during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs tested up to now. The number of
     * URLs tested is usually larger than the number URLS crawled because
     * typically a crawled URL is tested with multiple test payloads.
     *
     * Generated from protobuf field <code>int64 urls_tested_count = 7;</code>
     */
    private $urls_tested_count = 0;
    /**
     * Whether the scan run has found any vulnerabilities.
     *
     * Generated from protobuf field <code>bool has_vulnerabilities = 8;</code>
     */
    private $has_vulnerabilities = false;
    /**
     * The percentage of total completion ranging from 0 to 100.
     * If the scan is in queue, the value is 0.
     * If the scan is running, the value ranges from 0 to 100.
     * If the scan is finished, the value is 100.
     *
     * Generated from protobuf field <code>int32 progress_percent = 9;</code>
     */
    private $progress_percent = 0;
    /**
     * If result_state is an ERROR, this field provides the primary reason for
     * scan's termination and more details, if such are available.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10;</code>
     */
    private $error_trace = null;
    /**
     * A list of warnings, if such are encountered during this scan run.
     *
     * Generated from protobuf field <code>repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11;</code>
     */
    private $warning_traces;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The resource name of the ScanRun. The name follows the format of
     *           'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
     *           The ScanRun IDs are generated by the system.
     *     @type int $execution_state
     *           The execution state of the ScanRun.
     *     @type int $result_state
     *           The result state of the ScanRun. This field is only available after the
     *           execution state reaches "FINISHED".
     *     @type \Google\Protobuf\Timestamp $start_time
     *           The time at which the ScanRun started.
     *     @type \Google\Protobuf\Timestamp $end_time
     *           The time at which the ScanRun reached termination state - that the ScanRun
     *           is either finished or stopped by user.
     *     @type int|string $urls_crawled_count
     *           The number of URLs crawled during this ScanRun. If the scan is in progress,
     *           the value represents the number of URLs crawled up to now.
     *     @type int|string $urls_tested_count
     *           The number of URLs tested during this ScanRun. If the scan is in progress,
     *           the value represents the number of URLs tested up to now. The number of
     *           URLs tested is usually larger than the number URLS crawled because
     *           typically a crawled URL is tested with multiple test payloads.
     *     @type bool $has_vulnerabilities
     *           Whether the scan run has found any vulnerabilities.
     *     @type int $progress_percent
     *           The percentage of total completion ranging from 0 to 100.
     *           If the scan is in queue, the value is 0.
     *           If the scan is running, the value ranges from 0 to 100.
     *           If the scan is finished, the value is 100.
     *     @type \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace $error_trace
     *           If result_state is an ERROR, this field provides the primary reason for
     *           scan's termination and more details, if such are available.
     *     @type \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace[]|\Google\Protobuf\Internal\RepeatedField $warning_traces
     *           A list of warnings, if such are encountered during this scan run.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Websecurityscanner\V1Beta\ScanRun::initOnce();
        parent::__construct($data);
    }

    /**
     * The resource name of the ScanRun. The name follows the format of
     * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
     * The ScanRun IDs are generated by the system.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The resource name of the ScanRun. The name follows the format of
     * 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
     * The ScanRun IDs are generated by the system.
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The execution state of the ScanRun.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2;</code>
     * @return int
     */
    public function getExecutionState()
    {
        return $this->execution_state;
    }

    /**
     * The execution state of the ScanRun.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ExecutionState execution_state = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setExecutionState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun\ExecutionState::class);
        $this->execution_state = $var;

        return $this;
    }

    /**
     * The result state of the ScanRun. This field is only available after the
     * execution state reaches "FINISHED".
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3;</code>
     * @return int
     */
    public function getResultState()
    {
        return $this->result_state;
    }

    /**
     * The result state of the ScanRun. This field is only available after the
     * execution state reaches "FINISHED".
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRun.ResultState result_state = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setResultState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRun\ResultState::class);
        $this->result_state = $var;

        return $this;
    }

    /**
     * The time at which the ScanRun started.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 4;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getStartTime()
    {
        return isset($this->start_time) ? $this->start_time : null;
    }

    public function hasStartTime()
    {
        return isset($this->start_time);
    }

    public function clearStartTime()
    {
        unset($this->start_time);
    }

    /**
     * The time at which the ScanRun started.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp start_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setStartTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->start_time = $var;

        return $this;
    }

    /**
     * The time at which the ScanRun reached termination state - that the ScanRun
     * is either finished or stopped by user.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 5;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getEndTime()
    {
        return isset($this->end_time) ? $this->end_time : null;
    }

    public function hasEndTime()
    {
        return isset($this->end_time);
    }

    public function clearEndTime()
    {
        unset($this->end_time);
    }

    /**
     * The time at which the ScanRun reached termination state - that the ScanRun
     * is either finished or stopped by user.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp end_time = 5;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setEndTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->end_time = $var;

        return $this;
    }

    /**
     * The number of URLs crawled during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs crawled up to now.
     *
     * Generated from protobuf field <code>int64 urls_crawled_count = 6;</code>
     * @return int|string
     */
    public function getUrlsCrawledCount()
    {
        return $this->urls_crawled_count;
    }

    /**
     * The number of URLs crawled during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs crawled up to now.
     *
     * Generated from protobuf field <code>int64 urls_crawled_count = 6;</code>
     * @param int|string $var
     * @return $this
     */
    public function setUrlsCrawledCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->urls_crawled_count = $var;

        return $this;
    }

    /**
     * The number of URLs tested during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs tested up to now. The number of
     * URLs tested is usually larger than the number URLS crawled because
     * typically a crawled URL is tested with multiple test payloads.
     *
     * Generated from protobuf field <code>int64 urls_tested_count = 7;</code>
     * @return int|string
     */
    public function getUrlsTestedCount()
    {
        return $this->urls_tested_count;
    }

    /**
     * The number of URLs tested during this ScanRun. If the scan is in progress,
     * the value represents the number of URLs tested up to now. The number of
     * URLs tested is usually larger than the number URLS crawled because
     * typically a crawled URL is tested with multiple test payloads.
     *
     * Generated from protobuf field <code>int64 urls_tested_count = 7;</code>
     * @param int|string $var
     * @return $this
     */
    public function setUrlsTestedCount($var)
    {
        GPBUtil::checkInt64($var);
        $this->urls_tested_count = $var;

        return $this;
    }

    /**
     * Whether the scan run has found any vulnerabilities.
     *
     * Generated from protobuf field <code>bool has_vulnerabilities = 8;</code>
     * @return bool
     */
    public function getHasVulnerabilities()
    {
        return $this->has_vulnerabilities;
    }

    /**
     * Whether the scan run has found any vulnerabilities.
     *
     * Generated from protobuf field <code>bool has_vulnerabilities = 8;</code>
     * @param bool $var
     * @return $this
     */
    public function setHasVulnerabilities($var)
    {
        GPBUtil::checkBool($var);
        $this->has_vulnerabilities = $var;

        return $this;
    }

    /**
     * The percentage of total completion ranging from 0 to 100.
     * If the scan is in queue, the value is 0.
     * If the scan is running, the value ranges from 0 to 100.
     * If the scan is finished, the value is 100.
     *
     * Generated from protobuf field <code>int32 progress_percent = 9;</code>
     * @return int
     */
    public function getProgressPercent()
    {
        return $this->progress_percent;
    }

    /**
     * The percentage of total completion ranging from 0 to 100.
     * If the scan is in queue, the value is 0.
     * If the scan is running, the value ranges from 0 to 100.
     * If the scan is finished, the value is 100.
     *
     * Generated from protobuf field <code>int32 progress_percent = 9;</code>
     * @param int $var
     * @return $this
     */
    public function setProgressPercent($var)
    {
        GPBUtil::checkInt32($var);
        $this->progress_percent = $var;

        return $this;
    }

    /**
     * If result_state is an ERROR, this field provides the primary reason for
     * scan's termination and more details, if such are available.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10;</code>
     * @return \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace
     */
    public function getErrorTrace()
    {
        return isset($this->error_trace) ? $this->error_trace : null;
    }

    public function hasErrorTrace()
    {
        return isset($this->error_trace);
    }

    public function clearErrorTrace()
    {
        unset($this->error_trace);
    }

    /**
     * If result_state is an ERROR, this field provides the primary reason for
     * scan's termination and more details, if such are available.
     *
     * Generated from protobuf field <code>.google.cloud.websecurityscanner.v1beta.ScanRunErrorTrace error_trace = 10;</code>
     * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace $var
     * @return $this
     */
    public function setErrorTrace($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunErrorTrace::class);
        $this->error_trace = $var;

        return $this;
    }

    /**
     * A list of warnings, if such are encountered during this scan run.
     *
     * Generated from protobuf field <code>repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getWarningTraces()
    {
        return $this->warning_traces;
    }

    /**
     * A list of warnings, if such are encountered during this scan run.
     *
     * Generated from protobuf field <code>repeated .google.cloud.websecurityscanner.v1beta.ScanRunWarningTrace warning_traces = 11;</code>
     * @param \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setWarningTraces($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\WebSecurityScanner\V1beta\ScanRunWarningTrace::class);
        $this->warning_traces = $arr;

        return $this;
    }

}

