from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_runtime_write_gate_review_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-runtime-write-gate-review")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_runtime_write_gate_review_v1"
    assert data["program_status"]["current_task_id"] == "P2-403G"
    assert data["program_status"]["next_task_id"] == "P2-403H"
    assert data["program_status"]["overall_completion_percent"] == 94
    assert data["runtime_write_truth"]["runtime_write_allowed"] is False
    assert data["runtime_write_truth"]["dual_approval_received_count"] == 0
    assert data["runtime_write_truth"]["dry_run_hash_verified_count"] == 0
    assert data["runtime_write_truth"]["post_write_verifier_pass_count"] == 0
    assert data["rollups"]["live_write_count_total"] == 0
