"""
Constants for Panopticas file type analysis.
"""

VERSION = "0.0.14"

EXT_FILETYPES = {
    ".c": "C",
    ".class": "Java Class",
    ".cpp": "C++",
    ".cs": "C#",
    ".css": "CSS",
    ".csv": "CSV",
    ".dockerignore": "Dockerignore",
    ".exe": "Executable",
    ".gitignore": "Gitignore",
    ".gitattributes": "GitAttributes",
    ".go": "Go",
    ".gif": "GIF",
    ".gitleaksignore": "GitLeaksIgnore",
    ".gvy": "Groovy",  # Less common for Groovy
    ".groovy": "Groovy",
    ".gsp": "Groovy Server Pages",
    ".h": "C Header",
    ".htm": "HTML",
    ".html": "HTML",
    ".ico": "ICO",
    ".ini": "INI",
    ".ipynb": "Jupyter Notebook",
    ".java": "Java",
    ".jar": "Java Archive",
    ".jmx": "Apache JMeter",
    ".jpg": "JPEG",
    ".jpeg": "JPEG",
    ".js": "JavaScript",
    ".json": "JSON",
    ".jsx": "JSX",
    ".kt": "Kotlin",
    ".lock": "Lock",
    ".m": "Objective-C",
    ".mailmap": "Mailmap",
    ".md": "Markdown",
    ".nvmrc": "nvmrc",
    ".pdf": "PDF",
    ".php": "PHP",
    ".pl": "Perl",
    ".pm": "Perl",
    ".png": "PNG",
    ".properties": "Properties",
    ".ps1": "PowerShell",
    ".py": "Python",
    ".python-version": "python-version",
    ".r": "R",
    ".rb": "Ruby",
    ".rs": "Rust",
    ".rst": "ReStructuredText",
    ".sarif": "SARIF",  # Static Analysis Results Interchange Format
    # https://sarifweb.azurewebsites.net/
    ".scala": "Scala",
    ".sh": "Shell",
    ".sql": "SQL",
    ".sqlfluff": "SQLFluff",
    ".sqlfluffignore": "SQLFluffIgnore",
    ".svg": "SVG",
    ".swift": "Swift",
    ".tf": "Terraform",
    ".toml": "TOML",
    ".ts": "TypeScript",
    ".tsv": "TSV",
    ".tsx": "TSX",
    ".txt": "Text",
    ".vue": "Vue",
    ".xml": "XML",
    ".xls": "Excel",
    ".xlsx": "Excel",
    ".yaml": "YAML",
    ".yml": "YAML",
    ".zip": "ZIP",
    # Special cases for files without extensions or .format files
    "codeowners": "CODEOWNERS",
    "dockerfile": "Dockerfile",
    "license": "Text",
    "makefile": "Makefile",
    "cname": "CNAME",  # Often GitHub et al will use a CNAME file for a URL to host from
}

LANGUAGE_BY_BASENAME = {
    "go.mod": "go.mod",
    "go.sum": "go.sum",
}

METADATA_RULES = {
    "extension_rules": {
        ".pm": ["module"],
        ".exe": ["binary"],
        ".gif": ["binary", "image"],
        ".jar": ["binary"],
        ".jpg": ["binary", "image"],
        ".jpeg": ["binary", "image"],
        ".zip": ["binary"],
        ".class": ["binary", "Java"],
        ".pdf": ["binary"],
        ".xls": ["binary", "Microsoft"],
        ".xlsx": ["binary", "Microsoft"],
        ".jmx": ["Apache", "JMeter", "XML"],
    },
    "exact_filename_rules": {
        "azure-pipelines.yml": ["pipeline", "Azure DevOps"],
        "bitbucket-pipelines.yml": ["pipeline", "Bitbucket"],
        "build.gradle": ["gradle", "build", "dependencies"],
        "claude.md": ["Claude", "AI", "Claude Code"],
        "codeowners": ["Git"],
        "eslint.config.js": ["JavaScript", "linter", "eslint", "config"],
        "gemini.md": ["Gemini", "AI", "Gemini CLI"],
        "pyproject.toml": ["build", "dependencies", "Python"],
        "uv.lock": ["dependencies", "Python", "uv"],
        "yarn.lock": ["dependencies", "JavaScript", "yarn"],
        ".gitattributes": ["Git"],
        ".gitlab-ci.yml": ["pipeline", "GitLab"],  # Three letter YAML extension
        ".gitlab-ci.yaml": ["pipeline", "GitLab"],  # Full four letter YAML extension
        ".gitleaksignore": ["GitLeaks", "Git", "ignore"],
        "jenkinsfile": ["pipeline", "Jenkins"],
        "jenkinsfile.groovy": ["pipeline", "Jenkins"],
        ".mailmap": ["Git"],
        ".python-version": ["Python", "dependencies"],
        ".sqlfluff": ["SQLFluff", "SQL", "linter"],
        ".nvmrc": ["Node", "dependencies"],
        ".gitignore": ["Git", "ignore"],
        "dockerfile": ["IaC", "Docker", "dependencies"],
        ".dockerignore": ["Docker", "ignore"],
        "makefile": ["build"],
        "go.mod": ["Go", "module", "dependencies"],
        "go.sum": ["Go", "dependencies", "checksum"],
        ".sqlfluffignore": ["SQLFluff", "ignore"],
        "codefresh.yml": ["pipeline", "Codefresh"],
        ".travis.yml": ["pipeline", "TravisCI"],
        "package.json": ["npm", "dependencies"],
        "package-lock.json": ["npm", "dependencies"],
        "pom.xml": ["maven", "build", "dependencies"],
    },
    "path_contains_rules": {
        # Order of precendence is important, as the search will return most likely the first
        # More specific rules first
        ".github/workflows": [
            "workflow",
            "pipeline",
            "GitHub",
            "Git",
        ],  # More specific paths first
        ".buildkite/": ["pipeline", "Buildkite"],
        ".circleci/": ["pipeline", "CircleCI"],
        ".github": ["GitHub", "Git"],
    },
    "function_rules": [
        ("is_pip_requirements", ["pip", "Python", "PyPi", "dependencies"]),
    ],
}
