from linter_adapters.common import BaseCategory, Severity
from linter_adapters.parser import BaseViolationParser


class Flake8RSTDocstringsCategory(BaseCategory):
    Info            = 100
    Warning         = 200
    Error           = 300
    Severe          = 400
    ParsingError    = 900

@BaseViolationParser.register_decorator('RST')
class Flake8RSTDocstringsViolationParser(BaseViolationParser[Flake8RSTDocstringsCategory]):
    ViolationCategory = Flake8RSTDocstringsCategory
    provider_name = 'flake8-rst-docstrings'
    severity_mapping = \
    {
        Flake8RSTDocstringsCategory.Info:           Severity.Warning,
        Flake8RSTDocstringsCategory.Warning:        Severity.Warning,
        Flake8RSTDocstringsCategory.Error:          Severity.Error,
        Flake8RSTDocstringsCategory.Severe:         Severity.Error,
        Flake8RSTDocstringsCategory.ParsingError:   Severity.Fatal,
    }
    default_severity = Severity.Warning


__all__ = \
[
    'Flake8RSTDocstringsCategory',
    'Flake8RSTDocstringsViolationParser',
]
