from pathlib import Path

ROOT = Path(__file__).resolve().parents[2]
SCANNED = [ROOT / "app", ROOT / "mcp", ROOT / "config"]
FORBIDDEN = "agente_" + "contas_tim"


def test_no_legacy_imports_or_references():
    violations = []
    for base in SCANNED:
        for path in base.rglob("*"):
            if not path.is_file() or path.suffix not in {".py", ".yaml", ".yml"}:
                continue
            text = path.read_text(encoding="utf-8", errors="ignore")
            if FORBIDDEN in text:
                violations.append(str(path.relative_to(ROOT)))
    assert not violations, f"Dependências do pacote anterior encontradas: {violations}"
