import abc
from typing import Any, Dict, List, Optional

from yardstick import artifact


class VulnerabilityScanner(abc.ABC):
    @staticmethod
    @abc.abstractmethod
    def install(
        version: str,
        path: Optional[str] = None,
        use_cache: Optional[bool] = True,
        **kwargs,
    ) -> "VulnerabilityScanner":
        raise NotImplementedError

    @abc.abstractmethod
    def capture(self, image: str, tool_input: Optional[str]) -> str:
        raise NotImplementedError

    @staticmethod
    @abc.abstractmethod
    def parse(result: str, config: artifact.ScanConfiguration) -> List[artifact.Match]:
        raise NotImplementedError

    @staticmethod
    @abc.abstractmethod
    def parse_package_type(full_entry: Optional[Dict[str, Any]]) -> str:
        raise NotImplementedError
