from __future__ import annotations

from app.core.database import get_code_chunks_db


async def count_graph_deltas(repo_id: str, snapshot_id: str) -> int:
    db = get_code_chunks_db()
    return await db.graph_deltas.count_documents({"repo_id": repo_id, "snapshot_id": snapshot_id})


async def count_completed_commits(repo_id: str, snapshot_id: str) -> int:
    db = get_code_chunks_db()
    return await db.commit_processing_state.count_documents(
        {
            "repo_id": repo_id,
            "snapshot_id": snapshot_id,
            "status": "completed",
        }
    )
