# Copyright 2019 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

from enum import Enum, auto
from dataclasses import dataclass
from abc import abstractmethod
from plugins import Plugin, PluginResult
from typing import List, Optional

class Severity(Enum):
    BLOCKER = auto()
    CRITICAL = auto()
    MAJOR = auto()
    MINOR = auto()
    INFO = auto()

class Kind(Enum):
    BUG = auto()
    VULNERABILITY = auto()
    CODE_SMELL = auto()

@dataclass
class Location:

    filepath: str
    startLine: int
    endLine: int
    startColumn: int
    endColumn: int

@dataclass
class Issue:

    kind: Kind
    severity: Severity
    message: str
    effort: int
    location: Location

class Issues(PluginResult):

    def __init__(self, items):
        self.items: List[Issue] = items

class IssueCollector(Plugin):

    @abstractmethod
    def close(self) -> Issues:
        pass