from enum import Enum
from typing import List, Optional
from pydantic import BaseModel


class Ecosystem(str, Enum):
    NPM = "npm"
    PYPI = "PyPI"


class Severity(str, Enum):
    CRITICAL = "CRITICAL"
    HIGH = "HIGH"
    MODERATE = "MODERATE"
    LOW = "LOW"
    UNKNOWN = "UNKNOWN"


class Dependency(BaseModel):
    name: str
    version: str
    ecosystem: Ecosystem
    source_file: str


class Vulnerability(BaseModel):
    id: str
    summary: str
    details: str
    severity: Severity
    fixed_in: Optional[str] = None
    references: List[str] = []


class ScanResult(BaseModel):
    dependency: Dependency
    vulnerabilities: List[Vulnerability]
