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

namespace Grafeas\V1;

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

/**
 * An occurrence of a severity vulnerability on a resource.
 *
 * Generated from protobuf message <code>grafeas.v1.VulnerabilityOccurrence</code>
 */
class VulnerabilityOccurrence extends \Google\Protobuf\Internal\Message
{
    /**
     * The type of package; whether native or non native (e.g., ruby gems, node.js
     * packages, etc.).
     *
     * Generated from protobuf field <code>string type = 1;</code>
     */
    private $type = '';
    /**
     * Output only. The note provider assigned severity of this vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity severity = 2;</code>
     */
    private $severity = 0;
    /**
     * Output only. The CVSS score of this vulnerability. CVSS score is on a
     * scale of 0 - 10 where 0 indicates low severity and 10 indicates high
     * severity.
     *
     * Generated from protobuf field <code>float cvss_score = 3;</code>
     */
    private $cvss_score = 0.0;
    /**
     * The cvss v3 score for the vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSS cvssv3 = 10;</code>
     */
    private $cvssv3 = null;
    /**
     * Required. The set of affected locations and their fixes (if available)
     * within the associated resource.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4;</code>
     */
    private $package_issue;
    /**
     * Output only. A one sentence description of this vulnerability.
     *
     * Generated from protobuf field <code>string short_description = 5;</code>
     */
    private $short_description = '';
    /**
     * Output only. A detailed description of this vulnerability.
     *
     * Generated from protobuf field <code>string long_description = 6;</code>
     */
    private $long_description = '';
    /**
     * Output only. URLs related to this vulnerability.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.RelatedUrl related_urls = 7;</code>
     */
    private $related_urls;
    /**
     * The distro assigned severity for this vulnerability when it is available,
     * otherwise this is the note provider assigned severity.
     * When there are multiple PackageIssues for this vulnerability, they can have
     * different effective severities because some might be provided by the distro
     * while others are provided by the language ecosystem for a language pack.
     * For this reason, it is advised to use the effective severity on the
     * PackageIssue level. In the case where multiple PackageIssues have differing
     * effective severities, this field should be the highest severity for any of
     * the PackageIssues.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity effective_severity = 8;</code>
     */
    private $effective_severity = 0;
    /**
     * Output only. Whether at least one of the affected packages has a fix
     * available.
     *
     * Generated from protobuf field <code>bool fix_available = 9;</code>
     */
    private $fix_available = false;
    /**
     * Output only. CVSS version used to populate cvss_score and severity.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSSVersion cvss_version = 11;</code>
     */
    private $cvss_version = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $type
     *           The type of package; whether native or non native (e.g., ruby gems, node.js
     *           packages, etc.).
     *     @type int $severity
     *           Output only. The note provider assigned severity of this vulnerability.
     *     @type float $cvss_score
     *           Output only. The CVSS score of this vulnerability. CVSS score is on a
     *           scale of 0 - 10 where 0 indicates low severity and 10 indicates high
     *           severity.
     *     @type \Grafeas\V1\CVSS $cvssv3
     *           The cvss v3 score for the vulnerability.
     *     @type array<\Grafeas\V1\VulnerabilityOccurrence\PackageIssue>|\Google\Protobuf\Internal\RepeatedField $package_issue
     *           Required. The set of affected locations and their fixes (if available)
     *           within the associated resource.
     *     @type string $short_description
     *           Output only. A one sentence description of this vulnerability.
     *     @type string $long_description
     *           Output only. A detailed description of this vulnerability.
     *     @type array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $related_urls
     *           Output only. URLs related to this vulnerability.
     *     @type int $effective_severity
     *           The distro assigned severity for this vulnerability when it is available,
     *           otherwise this is the note provider assigned severity.
     *           When there are multiple PackageIssues for this vulnerability, they can have
     *           different effective severities because some might be provided by the distro
     *           while others are provided by the language ecosystem for a language pack.
     *           For this reason, it is advised to use the effective severity on the
     *           PackageIssue level. In the case where multiple PackageIssues have differing
     *           effective severities, this field should be the highest severity for any of
     *           the PackageIssues.
     *     @type bool $fix_available
     *           Output only. Whether at least one of the affected packages has a fix
     *           available.
     *     @type int $cvss_version
     *           Output only. CVSS version used to populate cvss_score and severity.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Grafeas\V1\Vulnerability::initOnce();
        parent::__construct($data);
    }

    /**
     * The type of package; whether native or non native (e.g., ruby gems, node.js
     * packages, etc.).
     *
     * Generated from protobuf field <code>string type = 1;</code>
     * @return string
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * The type of package; whether native or non native (e.g., ruby gems, node.js
     * packages, etc.).
     *
     * Generated from protobuf field <code>string type = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setType($var)
    {
        GPBUtil::checkString($var, True);
        $this->type = $var;

        return $this;
    }

    /**
     * Output only. The note provider assigned severity of this vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity severity = 2;</code>
     * @return int
     */
    public function getSeverity()
    {
        return $this->severity;
    }

    /**
     * Output only. The note provider assigned severity of this vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity severity = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setSeverity($var)
    {
        GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class);
        $this->severity = $var;

        return $this;
    }

    /**
     * Output only. The CVSS score of this vulnerability. CVSS score is on a
     * scale of 0 - 10 where 0 indicates low severity and 10 indicates high
     * severity.
     *
     * Generated from protobuf field <code>float cvss_score = 3;</code>
     * @return float
     */
    public function getCvssScore()
    {
        return $this->cvss_score;
    }

    /**
     * Output only. The CVSS score of this vulnerability. CVSS score is on a
     * scale of 0 - 10 where 0 indicates low severity and 10 indicates high
     * severity.
     *
     * Generated from protobuf field <code>float cvss_score = 3;</code>
     * @param float $var
     * @return $this
     */
    public function setCvssScore($var)
    {
        GPBUtil::checkFloat($var);
        $this->cvss_score = $var;

        return $this;
    }

    /**
     * The cvss v3 score for the vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSS cvssv3 = 10;</code>
     * @return \Grafeas\V1\CVSS|null
     */
    public function getCvssv3()
    {
        return $this->cvssv3;
    }

    public function hasCvssv3()
    {
        return isset($this->cvssv3);
    }

    public function clearCvssv3()
    {
        unset($this->cvssv3);
    }

    /**
     * The cvss v3 score for the vulnerability.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSS cvssv3 = 10;</code>
     * @param \Grafeas\V1\CVSS $var
     * @return $this
     */
    public function setCvssv3($var)
    {
        GPBUtil::checkMessage($var, \Grafeas\V1\CVSS::class);
        $this->cvssv3 = $var;

        return $this;
    }

    /**
     * Required. The set of affected locations and their fixes (if available)
     * within the associated resource.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getPackageIssue()
    {
        return $this->package_issue;
    }

    /**
     * Required. The set of affected locations and their fixes (if available)
     * within the associated resource.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.VulnerabilityOccurrence.PackageIssue package_issue = 4;</code>
     * @param array<\Grafeas\V1\VulnerabilityOccurrence\PackageIssue>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setPackageIssue($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\VulnerabilityOccurrence\PackageIssue::class);
        $this->package_issue = $arr;

        return $this;
    }

    /**
     * Output only. A one sentence description of this vulnerability.
     *
     * Generated from protobuf field <code>string short_description = 5;</code>
     * @return string
     */
    public function getShortDescription()
    {
        return $this->short_description;
    }

    /**
     * Output only. A one sentence description of this vulnerability.
     *
     * Generated from protobuf field <code>string short_description = 5;</code>
     * @param string $var
     * @return $this
     */
    public function setShortDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->short_description = $var;

        return $this;
    }

    /**
     * Output only. A detailed description of this vulnerability.
     *
     * Generated from protobuf field <code>string long_description = 6;</code>
     * @return string
     */
    public function getLongDescription()
    {
        return $this->long_description;
    }

    /**
     * Output only. A detailed description of this vulnerability.
     *
     * Generated from protobuf field <code>string long_description = 6;</code>
     * @param string $var
     * @return $this
     */
    public function setLongDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->long_description = $var;

        return $this;
    }

    /**
     * Output only. URLs related to this vulnerability.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.RelatedUrl related_urls = 7;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getRelatedUrls()
    {
        return $this->related_urls;
    }

    /**
     * Output only. URLs related to this vulnerability.
     *
     * Generated from protobuf field <code>repeated .grafeas.v1.RelatedUrl related_urls = 7;</code>
     * @param array<\Grafeas\V1\RelatedUrl>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setRelatedUrls($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Grafeas\V1\RelatedUrl::class);
        $this->related_urls = $arr;

        return $this;
    }

    /**
     * The distro assigned severity for this vulnerability when it is available,
     * otherwise this is the note provider assigned severity.
     * When there are multiple PackageIssues for this vulnerability, they can have
     * different effective severities because some might be provided by the distro
     * while others are provided by the language ecosystem for a language pack.
     * For this reason, it is advised to use the effective severity on the
     * PackageIssue level. In the case where multiple PackageIssues have differing
     * effective severities, this field should be the highest severity for any of
     * the PackageIssues.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity effective_severity = 8;</code>
     * @return int
     */
    public function getEffectiveSeverity()
    {
        return $this->effective_severity;
    }

    /**
     * The distro assigned severity for this vulnerability when it is available,
     * otherwise this is the note provider assigned severity.
     * When there are multiple PackageIssues for this vulnerability, they can have
     * different effective severities because some might be provided by the distro
     * while others are provided by the language ecosystem for a language pack.
     * For this reason, it is advised to use the effective severity on the
     * PackageIssue level. In the case where multiple PackageIssues have differing
     * effective severities, this field should be the highest severity for any of
     * the PackageIssues.
     *
     * Generated from protobuf field <code>.grafeas.v1.Severity effective_severity = 8;</code>
     * @param int $var
     * @return $this
     */
    public function setEffectiveSeverity($var)
    {
        GPBUtil::checkEnum($var, \Grafeas\V1\Severity::class);
        $this->effective_severity = $var;

        return $this;
    }

    /**
     * Output only. Whether at least one of the affected packages has a fix
     * available.
     *
     * Generated from protobuf field <code>bool fix_available = 9;</code>
     * @return bool
     */
    public function getFixAvailable()
    {
        return $this->fix_available;
    }

    /**
     * Output only. Whether at least one of the affected packages has a fix
     * available.
     *
     * Generated from protobuf field <code>bool fix_available = 9;</code>
     * @param bool $var
     * @return $this
     */
    public function setFixAvailable($var)
    {
        GPBUtil::checkBool($var);
        $this->fix_available = $var;

        return $this;
    }

    /**
     * Output only. CVSS version used to populate cvss_score and severity.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSSVersion cvss_version = 11;</code>
     * @return int
     */
    public function getCvssVersion()
    {
        return $this->cvss_version;
    }

    /**
     * Output only. CVSS version used to populate cvss_score and severity.
     *
     * Generated from protobuf field <code>.grafeas.v1.CVSSVersion cvss_version = 11;</code>
     * @param int $var
     * @return $this
     */
    public function setCvssVersion($var)
    {
        GPBUtil::checkEnum($var, \Grafeas\V1\CVSSVersion::class);
        $this->cvss_version = $var;

        return $this;
    }

}

