from typing import Optional, List
from pydantic import BaseModel, Field

from sator_core.models.enums import ImpactType, WeaknessType


class VulnerabilityDescriptor(BaseModel):
    """
    Vulnerability Descriptor model
    """
    weakness_type: Optional[WeaknessType] = Field(default=None)
    impact_types: List[ImpactType] = Field(default_factory=list)
    # TODO: add more fields

    def any(self) -> bool:
        return any([self.weakness_type, len(self.impact_types) > 0])
