from __future__ import annotations

from pathlib import PurePosixPath

from app.modules.rag.contracts import DocKind


class DocsClassifier:
    def classify(self, path: str) -> str:
        upper = PurePosixPath(path).name.upper()
        lowered = path.lower()
        if "runbook" in lowered or upper.startswith("RUNBOOK"):
            return DocKind.RUNBOOK
        if upper.startswith("README"):
            return DocKind.README
        if "spec" in lowered or "architecture" in lowered:
            return DocKind.SPEC
        return DocKind.MISC
