"""Module contains class for storing information about CVEs from vendor Cisco."""

from cve_connector.vendor_cve.implementation.vendors_storage_structures.general_vendor import Vendor

from cve_connector.vendor_cve.implementation.utilities.check_correctness \
    import is_correct_cve_id, is_correct_cwe


class Cisco(Vendor):
    """
    Class for storing information about CVEs from vendor Cisco.
    """
    def __init__(self, cve='', adv_id='', sev='', summary='', details='', analysis='',
                 att_vector='', published=None, patch=False):
        super().__init__()
        self.cve_id = cve
        self.cwes = []
        self.advisory_id = adv_id
        self.severity = sev
        self.summary = summary
        self.details = details
        self.analysis = analysis
        self.attack_vector = att_vector
        self.published = published
        self.description = ''

        self.patch_available = patch

        self.cvss_v3 = None

    def is_valid_entity(self):
        """
        Tests correctness of created instance of this class.

        :return: True if valid
        """
        return is_correct_cve_id(self.cve_id) and all(is_correct_cwe(cwe) for cwe in self.cwes)
