import re
from typing import Dict, Pattern, Tuple, Union

from .models import BookmarkTitle

# partly inspired by https://github.com/KMCS-NII/AASC/blob/master/section_classify/section_classify.pl
titles_of_interest: Dict[BookmarkTitle, Tuple[Union[str, Pattern], ...]] = {
    "Abstract": ("abstract",),
    "Author contribution": (
        "author contribution",
        "credit authorship contribution statement",
        "credit author statement",
        "corresponding author",
    ),
    "Introduction": (
        "introduction",
        "preliminaries",
        "research question",
        "objective",
        "purpose",
        re.compile(r"^aim$"),
        "proposition",
        "what this study adds",
        "what does this study add",
    ),
    "Background": (
        "background",
        "previous",
        "prior",
        "relevant work",
        "state of the art",
        "related work",
        "research in context",
        "earlier work",
        "related work",
        "problem",
        "challenge",
        "goal",
        "literature review",
        re.compile(r"^review$"),
        re.compile(r"^existing"),
        "comparison with existing literature",
        "literature search",
        "comparison with other studies",
        "study area",
    ),
    "Methods": (
        "method",
        "approach",
        re.compile(r"^our"),
        "proposed",
        "study design",
        "procedure",
        "formulation",
        "methodology",
        "research design",
        "study protocol",
        "design",
        re.compile(r"experimental (?!result)"),
        "overview",
        "approach",
        "system",
        "definition",
        "algorithm",
        "model",
        "setup",
        "implementation",
        "evaluation metric",
        "scheme",
    ),
    "Results": (
        "result",
        "data",
        "outcome",
        "statistic",
        "statistics",
        "statistical analysis",
        "analysis",
        "measure",
        "experiment",
        "finding",
        "hypothesis testing",
        "proof of proposition",
        "proof of concept",
        "report",
        "implication of all the available evidence",
        "contribution",
        "evaluation",
        "performance",
        "demonstration",
        "demonstrating",
        "example",
        "study",
        "studies",
        "qualitative comparison",
        "quantitative comparison",
        "validation",
    ),
    "Discussion": (
        "discussion",
        "recommendation",
        "implication",
        "findings",
        "impact",
        "limitation",
        "assessment",
        "quality assessment",
        "interpretation",
        "contribution",
        "explanation",
    ),
    "Outlook": (
        "outlook",
        "future research",
        "future",
        "follow up",
        "remaining",
        "prospect",
        "perspective",
    ),
    "Conclusion": (
        "conclusion",
        "conclude",
        "concluding",
        "concluding",
        "final remark",
        "remark",
        "conclusie",
    ),
    "Conflict of interest": (
        "compete interest",
        "funding support and author disclosure",
        "conflict of interest",
        "disclosure statement",
        "role of the funding source",
        "disclaimer",
        "conflicting interest",
        "declaration of interest",
        "risk of bias",
        "funding",
        "disclosure",
        "declaration",
    ),
    "Acknowledgement": ("acknowledgement", "acknowledgment"),
}
