from ...utils.vocabulary import BaseVocabulary


class ENVocabulary(BaseVocabulary):
    """CLLM token vocabulary with synonyms and patterns"""

    def __init__(self):
        super().__init__()

    @property
    def CODE_INDICATORS(self) -> tuple[str, ...]:
        return (
            "code",
            "script",
            "function",
            "program",
            "algorithm",
            "snippet",
            "file",
            "implementation",
            "syntax",
            "debug",
            "compile",
            "runtime",
            "library",
            "framework",
            "api",
            "class",
            "method",
            "variable",
            "module",
            "package",
            "import",
            "dependency",
            "namespace",
            "interface",
            "repository",
            "repo",
            "git",
            "commit",
            "branch",
            "pull request",
            "pr",
            "merge",
            "deploy",
            "build",
            "unittest",
            "test case",
            "coverage",
            "lint",
            "refactor",
        )

    @property
    def ACTION_VERBS(self) -> tuple[str, ...]:
        return (
            "reduce",
            "increase",
            "improve",
            "optimize",
            "enhance",
            "update",
            "modify",
            "refactor",
            "upgrade",
            "migrate",
            "fix",
            "solve",
            "resolve",
            "debug",
            "repair",
            "troubleshoot",
            "diagnose",
            "patch",
            "create",
            "generate",
            "build",
            "make",
            "produce",
            "design",
            "develop",
            "construct",
            "implement",
            "analyze",
            "examine",
            "review",
            "evaluate",
            "assess",
            "validate",
            "verify",
            "test",
            "measure",
            "monitor",
            "explain",
            "describe",
            "clarify",
            "define",
            "document",
            "calculate",
            "compute",
            "determine",
            "find",
            "process",
            "compare",
            "contrast",
            "differentiate",
            "classify",
            "categorize",
            "sort",
            "organize",
            "group",
            "extract",
            "transform",
            "load",
            "aggregate",
            "filter",
            "deploy",
            "release",
            "rollback",
            "scale",
            "provision",
            "highlight",
            "identify",
            "show",
            "demonstrate",
            "display",
        )

    @property
    def STOPWORDS(self) -> tuple[str, ...]:
        return (
            "it",
            "this",
            "that",
            "these",
            "those",
            "a",
            "an",
            "the",
            "some",
            "any",
            "all",
            "none",
            "such",
            "the following",
            "something",
            "anything",
            "everything",
            "nothing",
            "someone",
            "anyone",
            "everyone",
            "no one",
        )

    @property
    def PRONOUNS(self) -> tuple[str, ...]:
        return (
            "i",
            "we",
            "you",
            "they",
            "he",
            "she",
            "it",
            "me",
            "us",
            "them",
            "him",
            "her",
            "my",
            "our",
            "your",
            "their",
            "his",
            "her",
            "its",
            "mine",
            "ours",
            "yours",
            "theirs",
            "hers",
        )

    @property
    def MODALS(self) -> tuple[str, ...]:
        return (
            "can",
            "could",
            "should",
            "would",
            "will",
            "shall",
            "may",
            "might",
            "must",
            "do",
            "does",
            "did",
        )

    @property
    def QUANTIFIER_WORDS(self) -> tuple[str, ...]:
        return (
            "all",
            "every",
            "everything",
            "each",
            "entire",
            "whole",
            "any",
            "some",
            "both",
        )

    @property
    def DEMONSTRATIVES(self) -> list[str]:
        return ["this", "that", "these", "those"]

    @property
    def CONCEPT_INDICATORS(self) -> list[str]:
        """Optional - can have sensible default"""
        return ["concept of", "idea of", "notion of", "principle of"]

    @property
    def MEETING_WORDS(self) -> tuple[str, ...]:
        """Optional - can have empty default"""
        return (
            "meeting",
            "conference",
            "call",
            "session",
            "standup",
            "stand-up",
            "sync",
            "review",
            "retrospective",
            "retro",
            "sprint planning",
            "one-on-one",
            "1:1",
            "1-on-1",
            "briefing",
            "discussion",
            "presentation",
            "workshop",
            "training",
            "demo",
            "demonstration",
        )

    @property
    def PROPOSAL_WORDS(self) -> list[str]:
        """Optional - can have empty default"""
        return ["proposal", "proposition", "offer", "suggestion"]

    @property
    def ARTICLES(self) -> list[str]:
        """Optional - can have empty default"""
        return ["a", "an", "the"]

    @property
    def COMPOUND_PHRASES(self) -> dict[str, str]:
        return {
            "customer support": "TICKET",
            "customer service": "TICKET",
            "support ticket": "TICKET",
            "service ticket": "TICKET",
            "help desk": "TICKET",
            "support case": "TICKET",
            "customer complaint": "COMPLAINT",
            "customer feedback": "FEEDBACK",
            "customer inquiry": "INQUIRY",
            "customer request": "REQUEST",
            "email message": "EMAIL",
            "chat thread_encoder": "TRANSCRIPT",
            "chat log": "TRANSCRIPT",
            "conversation thread_encoder": "TRANSCRIPT",
            "phone call": "CALL",
            "support call": "CALL",
            "sales call": "CALL",
            "source code": "CODE",
            "code review": "CODE",
            "pull request": "CODE",
            "error message": "LOG",
            "error log": "LOG",
            "stack trace": "LOG",
            "stacktrace": "LOG",
            "system log": "LOG",
            "api call": "ENDPOINT",
            "api endpoint": "ENDPOINT",
            "rest api": "ENDPOINT",
            "test case": "TEST",
            "unit test": "TEST",
            "test suite": "TEST",
            "test scenario": "TEST",
            "business plan": "PLAN",
            "project plan": "PLAN",
            "strategic plan": "PLAN",
            "product description": "DESCRIPTION",
            "product spec": "DESCRIPTION",
            "status update": "REPORT",
            "progress report": "REPORT",
            "executive summary": "SUMMARY",
            "meeting notes": "DOCUMENT",
            "user story": "DOCUMENT",
            "data pipeline": "SYSTEM",
            "database query": "QUERY",
            "sql query": "QUERY",
            "data warehouse": "SYSTEM",
        }

    @property
    def TYPE_MAP(self) -> dict[str, str]:
        return {
            "call": "CALL",
            "phone call": "CALL",
            "meeting": "MEETING",
            "chat": "CHAT",
            "email": "EMAIL",
            "message": "EMAIL",
            "conversation": "CONVERSATION",
            "report": "REPORT",
            "document": "DOCUMENT",
            "article": "ARTICLE",
            "thread_encoder": "TRANSCRIPT",
            "ticket": "TICKET",
            "case": "TICKET",
            "complaint": "COMPLAINT",
            "feedback": "FEEDBACK",
            "inquiry": "INQUIRY",
            "request": "REQUEST",
        }

    @property
    def CONTEXT_MAP(self) -> dict[str, str]:
        return {
            "customer": "CUSTOMER",
            "support": "SUPPORT",
            "sales": "SALES",
            "technical": "TECHNICAL",
            "engineering": "TECHNICAL",
            "product": "PRODUCT",
            "marketing": "MARKETING",
            "business": "BUSINESS",
            "finance": "FINANCE",
            "legal": "LEGAL",
            "hr": "HR",
            "operations": "OPERATIONS",
        }

    @property
    def domain_candidates(self) -> dict[str, list[str]]:
        return {
            "CODE": [
                "bug",
                "error",
                "security",
                "performance",
                "code",
                "script",
                "function",
                "program",
                "algorithm",
                "snippet",
                "file",
                "implementation",
                "syntax",
                "debug",
                "compile",
                "runtime",
                "library",
                "framework",
                "api",
            ],
            "ENTITIES": [
                "names",
                "dates",
                "amounts",
                "addresses",
                "emails",
                "phones",
            ],
            "QA": [
                "verification",
                "policy",
                "soft_skills",
                "accuracy",
                "compliance",
                "disclosures",
            ],
            "SUPPORT": [
                "issue",
                "sentiment",
                "actions",
                "urgency",
                "priority",
                "ticket",
                "case",
                "customer",
                "support",
                "call",
                "complaint",
                "csr",
                "agent",
                "caller",
                "chat",
                "inquiry",
                "troubleshoot",
            ],
            "TECHNICAL": [
                "bug",
                "error",
                "stacktrace",
                "exception",
                "api",
                "server",
                "log",
                "debug",
                "traceback",
                "crash",
                "deployment",
                "backend",
            ],
            "DOCUMENT": [
                "document",
                "article",
                "manual",
                "guide",
                "doc",
                "writeup",
                "thread_encoder",
                "notes",
                "summary",
                "instructions",
            ],
            "BUSINESS": [
                "report",
                "briefing",
                "analysis",
                "executive",
                "management",
                "dashboard",
                "kpi",
                "roi",
                "funnel",
                "quarterly",
                "presentation",
            ],
            "LEGAL": [
                "contract",
                "policy",
                "compliance",
                "gdpr",
                "clause",
                "lawyer",
                "agreement",
                "terms",
                "privacy",
            ],
            "FINANCE": [
                "invoice",
                "billing",
                "payment",
                "transaction",
                "refund",
                "expense",
                "balance",
                "statement",
                "amount",
            ],
            "SECURITY": [
                "breach",
                "risk",
                "threat",
                "alert",
                "malware",
                "phishing",
                "permissions",
                "access control",
                "audit",
            ],
            "MEDICAL": [
                "patient",
                "diagnosis",
                "prescription",
                "clinical",
                "chart",
                "symptoms",
                "treatment",
                "doctor",
            ],
            "SALES": [
                "lead",
                "crm",
                "opportunity",
                "pipeline",
                "account manager",
                "prospect",
                "deal",
                "quote",
            ],
            "EDUCATION": [
                "lesson",
                "curriculum",
                "teacher",
                "student",
                "training",
                "course",
                "learning",
            ],
        }

    @property
    def rank_triggers(self) -> set[str]:
        return {
            "rank by",
            "ranked by",
            "sort by",
            "sorted by",
            "order by",
            "ordered by",
            "arrange by",
            "prioritize by",
            "in order of",
            "by priority",
            "by importance",
            "highest to lowest",
            "lowest to highest",
            "best to worst",
            "top to bottom",
            "ranking",
            "rankings",
            "prioritization",
            "prioritize",
            "prioritizing",
        }

    @property
    def REQ_TOKENS(self) -> dict[str, list[str]]:
        return {
            "REVIEW": [
                "review",
                "look at",
                "go over",
                "examine quality",
                "assess quality",
                "evaluate quality",
                "check over",
                "look through",
                "survey",
                "appraise",
            ],
            "ASSESS": [
                "assess",
                "appraise",
                "gauge",
                "estimate quality",
                "judge",
                "measure quality",
                "rate quality",
                "weigh",
            ],
            "MONITOR": [
                "monitor",
                "track",
                "watch",
                "observe",
                "follow",
                "keep track of",
                "supervise",
            ],
            "PARSE": [
                "parse",
                "read",
                "interpret",
                "process document",
                "read document",
                "understand document",
            ],
            "ANALYZE": [
                "analyze",
                "review",
                "examine",
                "evaluate",
                "assess",
                "inspect",
                "check out",
                "audit",
                "investigate",
                "break down",
                "dissect",
                "study",
                "scrutinize",
                "look into",
            ],
            "MATCH": [
                "match",
                "compare",
                "align",
                "map",
                "correlate",
                "match against",
                "compare to",
                "check against",
            ],
            "EXTRACT": [
                "extract",
                "pull out",
                "identify",
                "find",
                "locate",
                "get",
                "retrieve",
                "return",
                "include",
                "select",
                "pick out",
                "capture",
                "obtain",
                "isolate",
                "pull",
                "grab",
            ],
            "SELECT": [
                "select",
                "choose",
                "pick",
                "filter",
                "identify matching",
                "find matching",
                "get matching",
                "retrieve matching",
                "pull matching",
                "show matching",
            ],
            "GENERATE": [
                "generate",
                "create",
                "write",
                "draft",
                "compose",
                "produce",
                "build",
                "develop",
                "design",
                "craft",
                "author",
                "make up",
                "name",
                "suggest",
                "formulate",
                "form",
                "construct",
                "propose",
                "transcribe",
            ],
            "SUMMARIZE": [
                "summarize",
                "condense",
                "brief",
                "synopsis",
                "sum up",
                "digest",
                "recap",
                "overview",
                "abstract",
                "précis",
            ],
            "TRANSFORM": [
                "convert",
                "transform",
                "change",
                "rewrite",
                "translate",
                "complete",
                "turn into",
                "modify",
                "adapt",
                "adjust",
                "rephrase",
                "rework",
                "rearrange",
                "edit",
                "add",
                "paraphrase",
                "fill",
                "remove",
                "replace",
                "reverse",
            ],
            "EXPLAIN": [
                "explain",
                "describe",
                "clarify",
                "elaborate",
                "tell me about",
                "detail",
                "expound",
                "illustrate",
                "express",
                "tell",
                "discuss",
                "define",
            ],
            "COMPARE": [
                "compare",
                "contrast",
                "versus",
                "vs",
                "difference between",
                "differentiate",
                "distinguish",
                "compare against",
                "evaluate against",
                "measure against",
                "benchmark",
                "weigh against",
            ],
            "CLASSIFY": [
                "classify",
                "categorize",
                "sort",
                "group",
                "label",
                "organize",
                "arrange",
                "order by",
                "segment",
            ],
            "DEBUG": [
                "debug",
                "troubleshoot",
                "diagnose",
                "fix bug",
                "investigate bug",
                "find bug",
                "track down",
                "identify issue",
            ],
            "OPTIMIZE": [
                "optimize",
                "improve",
                "enhance",
                "refactor",
                "speed up",
                "streamline",
                "maximize",
                "minimize",
                "reduce",
                "increase",
            ],
            "VALIDATE": [
                "validate",
                "verify",
                "check",
                "confirm",
                "test",
                "ensure",
                "certify",
                "authenticate",
            ],
            "SEARCH": [
                "search",
                "query",
                "lookup",
                "find",
                "look for",
                "seek",
                "hunt for",
                "discover",
            ],
            "RANK": [
                "prioritize",
                "order",
                "sort by",
                "rate",
                "score",
                "rank",
                "grade",
                "evaluate priority",
                "arrange by priority",
                "order by importance",
                "sequence",
                "position",
            ],
            "PREDICT": [
                "predict",
                "forecast",
                "estimate",
                "project",
                "anticipate",
                "foresee",
                "extrapolate",
            ],
            "FORMAT": [
                "format",
                "structure",
                "organize",
                "layout",
                "arrange",
                "restructure",
                "reformat",
                "style",
                "present",
                "display as",
            ],
            "DETECT": [
                "detect",
                "spot",
                "discover",
                "uncover",
                "identify",
                "notice",
                "recognize",
            ],
            "CALCULATE": [
                "calculate",
                "compute",
                "figure out",
                "determine mathematically",
                "quantify",
                "measure",
                "count",
                "tally",
            ],
            "AGGREGATE": [
                "aggregate",
                "group",
                "combine",
                "consolidate",
                "roll up",
                "merge",
                "compile",
                "collect",
            ],
            "DETERMINE": [
                "determine",
                "decide",
                "assess",
                "evaluate",
                "figure out",
                "conclude",
                "establish",
                "choose",
            ],
            "ROUTE": [
                "route",
                "assign",
                "direct",
                "forward",
                "send to",
                "delegate",
                "allocate",
            ],
            "EXECUTE": [
                "use",
                "apply",
                "implement",
                "run",
                "perform",
                "employ",
                "utilize",
            ],
            "LIST": [
                "list",
                "enumerate",
                "itemize",
                "outline",
                "show",
                "display",
                "provide list",
                "give me",
                "show me",
                "provide all",
            ],
        }

    @property
    def EPISTEMIC_KEYWORDS(self) -> dict[str, list[str]]:
        return {
            "future": [
                "next",
                "upcoming",
                "future",
                "will",
                "expected",
                "forecast",
                "prediction",
            ],
            "uncertainty": [
                "chance",
                "likelihood",
                "probability",
                "odds",
                "risk",
            ],
            "real_world": [
                "match",
                "season",
                "weather",
                "market",
                "stock",
                "team",
                "game",
            ],
        }

    @property
    def NOISE_VERBS(self) -> set[str]:
        return {
            "be",
            "have",
            "do",
            "can",
            "could",
            "should",
            "would",
            "may",
            "might",
            "must",
            "will",
            "shall",
            "go",
            "come",
            "take",
            "get",
            "make",
            "work",
            "live",
            "stay",
            "follow",
            "base",
            "relate",
            "need",
            "want",
            "start",
            "begin",
            "become",
            "seem",
            "appear",
            "remain",
            "show",
            "see",
            "know",
            "think",
            "feel",
            "say",
            "call",
        }

    @property
    def CONTEXT_FILTERS(self) -> dict[str, list[str]]:
        return {
            "give": ["given", "give me", "giving"],
            "follow": ["following", "as follows"],
            "base": ["based on", "base it on"],
            "use": ["useful", "used to", "uses"],
        }

    @property
    def TARGET_TOKENS(self) -> dict[str, list[str]]:
        return {
            "CODE": [
                "code",
                "script",
                "program",
                "function",
                "method",
                "class",
                "snippet",
            ],
            "NETWORK": [
                "network",
                "connectivity",
                "connection",
                "network infrastructure",
                "router",
                "switch",
                "firewall",
            ],
            "INVOICE": [
                "invoice",
                "bill",
                "receipt",
                "payment document",
                "billing document",
            ],
            "DATA": ["data", "dataset", "database", "spreadsheet", "table", "csv"],
            "QUERY": ["query", "sql", "sql query", "database query"],
            "ENDPOINT": ["endpoint", "api", "api endpoint", "rest endpoint"],
            "COMPONENT": ["component", "module", "package", "library"],
            "SYSTEM": [
                "system",
                "server",
                "application",
                "app",
                "software",
                "platform",
                "infrastructure",
            ],
            "TEST": ["test", "unit test", "test case", "test suite"],
            "LOG": ["log", "logs", "log file", "error log", "system log"],
            "RECORD": ["record", "entry", "row", "item"],
            "STRATEGY": ["strategy", "approach", "plan", "methodology"],
            "NBA_CATALOG": [
                "nba",
                "nbas",
                "next best action",
                "next best actions",
                "predefined actions",
                "possible actions",
                "available actions",
            ],
            "DOCUMENT": ["document", "doc", "file", "report", "paper"],
            "EMAIL": ["email", "message", "correspondence"],
            "REPORT": ["report", "analysis", "findings", "summary report"],
            "TICKET": ["ticket", "support ticket", "issue", "case"],
            "TRANSCRIPT": [
                "thread_encoder",
                "conversation",
                "dialogue",
                "chat log",
                "call recording",
                "chat history",
                "interaction log",
                "conversation record",
            ],
            "FEEDBACK": ["feedback", "comment", "review", "critique"],
            "COMMENT": ["comment", "remark", "note", "observation"],
            "CUSTOMER_INTENT": [
                "customer intent",
                "customer's intent",
                "customer need",
                "customer request",
                "customer goal",
                "customer problem",
            ],
            "COMPLAINT": ["complaint", "issue", "problem", "grievance"],
            "REQUEST": ["request", "customer request", "service request"],
            "INQUIRY": ["inquiry", "question", "query"],
            "INTERACTION": [
                "interaction",
                "support interaction",
                "customer interaction",
            ],
            "CALL": ["call", "phone call", "support call", "customer call"],
            "DESCRIPTION": ["description", "product description"],
            "SUMMARY": ["summary", "executive summary", "brief summary"],
            "PLAN": ["plan", "business plan", "project plan"],
            "POST": ["post", "linkedin post", "social media post", "blog post"],
            "PRESS_RELEASE": ["press release", "release", "announcement"],
            "INTRODUCTION": ["introduction", "intro"],
            "CAPTION": ["caption", "captions", "social media caption"],
            "QUESTIONS": ["questions", "interview questions", "quiz questions", "faq"],
            "RESPONSE": ["response", "reply", "answer", "template response"],
            "LOGS": ["logs", "log files", "traffic logs", "system logs", "access logs"],
            "CORRELATION": [
                "correlation",
                "correlations",
                "relationship",
                "relationships",
            ],
            "TRADEOFF": ["trade-off", "tradeoffs", "tradeoff", "trade-offs"],
            "PARADIGM": ["paradigm", "paradigms", "methodology", "approach"],
            "PAIN_POINTS": ["pain points", "pain point", "issues", "problems"],
            "PATTERN": ["pattern", "patterns", "trend", "trends"],
            "CHURN": ["churn", "customer churn", "attrition"],
            "FEATURES": ["features", "feature", "functionality", "capabilities"],
            "METRICS": [
                "revenue",
                "metrics",
                "statistics",
                "numbers",
                "data points",
                "KPIs",
                "performance data",
                "analytics",
                "measurements",
            ],
            "REGIONS": ["regions", "areas", "locations", "territories"],
            "ITEMS": ["items", "things", "elements", "list", "options", "choices"],
            "CONCEPT": ["concept", "idea", "notion", "principle", "theory"],
            "PROCEDURE": [
                "procedure",
                "process",
                "steps",
                "method",
                "technique",
                "methodology",
                "instructions",
                "steps",
                "workflow",
            ],
            "CONTRACT": ["contract", "agreement", "legal document", "terms", "SLA"],
            "FACT": ["fact", "facts", "information", "details", "truth"],
            "ANSWER": ["answer", "solution", "response"],
        }

    @property
    def EXTRACT_FIELDS(self) -> tuple[str, ...]:
        return (
            "ISSUE",
            "SENTIMENT",
            "ACTIONS",
            "NEXT_STEPS",
            "URGENCY",
            "PRIORITY",
            "NAMES",
            "DATES",
            "AMOUNTS",
            "EMAILS",
            "PHONES",
            "ADDRESSES",
            "BUGS",
            "SECURITY",
            "PERFORMANCE",
            "STYLE",
            "ERRORS",
            "WARNINGS",
            "KEYWORDS",
            "TOPICS",
            "ENTITIES",
            "FACTS",
            "DECISIONS",
            "DEADLINES",
            "REQUIREMENTS",
            "FEATURES",
            "PROBLEMS",
            "SOLUTIONS",
            "RISKS",
            "METRICS",
            "KPI",
            "SCORES",
            "RATINGS",
            "FEEDBACK",
            "COMPLAINTS",
            "OWNERS",
            "ASSIGNEES",
            "STAKEHOLDERS",
            "PARTICIPANTS",
            "TIMESTAMPS",
            "DURATIONS",
            "FREQUENCIES",
            "QUANTITIES",
            "CATEGORIES",
            "TAGS",
            "LABELS",
            "STATUS",
            "TYPE",
            "CUSTOMER_INTENT",
            "RELEVANCE_SCORE",
            "NBA_ID",
            "MATCH_CONFIDENCE",
            "SEMANTIC_SIMILARITY",
            "THRESHOLD",
        )

    @property
    def OUTPUT_FORMATS(self) -> dict[str, list[str]]:
        return {
            "JSON": ["json", "json format"],
            "MARKDOWN": ["markdown", "md"],
            "TABLE": ["table", "tabular"],
            "LIST": ["list", "bullet points", "bullets"],
            "PLAIN": ["plain text", "text only"],
            "CSV": ["csv", "comma-separated"],
        }

    @property
    def IMPERATIVE_PATTERNS(self) -> list[tuple[list[str], str, str]]:
        return [
            (["list", "enumerate", "itemize"], "LIST", "ITEMS"),
            (["name", "identify"], "GENERATE", "ITEMS"),
            (["give", "provide", "suggest"], "GENERATE", "ITEMS"),
            (
                ["tell", "explain", "describe", "clarify", "expand", "illustrate"],
                "EXPLAIN",
                "CONCEPT",
            ),
        ]

    @property
    def QUESTION_WORDS(self) -> list[str]:
        return ["what", "who", "where", "when", "why", "how", "which"]
