from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_critic_reviewer_result_capture_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-critic-reviewer-result-capture")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_critic_reviewer_result_capture_v1"
    assert data["program_status"]["current_task_id"] == "P2-105"
    assert data["program_status"]["next_task_id"] == "P2-106"
    assert data["program_status"]["overall_completion_percent"] == 100
    assert data["prior_readback"]["approval_24h_total"] == 66
    assert data["prior_readback"]["approved_without_execution_meta_24h"] == 63
    assert data["score_truth"]["critic_reviewer_score_required"] is True
    assert data["score_truth"]["result_capture_required"] is True
    assert data["score_truth"]["runtime_critic_score_enabled"] is False
    assert data["score_truth"]["runtime_reviewer_score_enabled"] is False
    assert data["score_truth"]["runtime_result_capture_enabled"] is False
    assert data["score_truth"]["telegram_send_enabled"] is False
    assert data["display_redaction_contract"]["work_window_transcript_display_allowed"] is False
    assert data["rollups"]["scorecard_count"] == 5
    assert data["rollups"]["result_capture_contract_count"] == 5
    assert data["rollups"]["promotion_gate_count"] == 6
    assert data["rollups"]["candidate_route_count"] == 4
    assert data["rollups"]["runtime_critic_score_count"] == 0
    assert data["rollups"]["runtime_reviewer_score_count"] == 0
    assert data["rollups"]["result_capture_runtime_write_count"] == 0
    assert data["rollups"]["learning_write_count"] == 0
    assert data["rollups"]["playbook_trust_write_count"] == 0
    assert data["rollups"]["telegram_send_count"] == 0
