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

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


class Microsoft(Vendor):
    """
    Class for storing information about CVEs from vendor Microsoft.
    """
    def __init__(self, cve_id='', severity='', impact='', published=None, descr='',
                 publ_discl='', expl='', title=''):
        super().__init__()
        self.cve_id = cve_id
        self.severity = severity
        self.impact = impact
        self.published = published
        self.description = descr
        self.publicly_disclosed = publ_discl
        self.exploited = expl
        self.cve_title = title

        self.patch_available = True

        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 self.cvss_v3.is_valid()
