from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_report_automation_review_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-report-automation-review")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_report_automation_review_v1"
    assert data["program_status"]["current_task_id"] == "P2-403J"
    assert data["program_status"]["next_task_id"] == "P2-403K"
    assert data["program_status"]["overall_completion_percent"] == 100
    assert data["report_truth"]["daily_report_ready"] is True
    assert data["report_truth"]["weekly_report_ready"] is True
    assert data["report_truth"]["monthly_report_ready"] is True
    assert data["report_truth"]["medium_low_auto_policy_defined"] is True
    assert data["report_truth"]["medium_low_auto_execution_enabled"] is False
    assert data["report_truth"]["high_risk_requires_approval"] is True
    assert data["rollups"]["report_cadence_count"] == 3
    assert data["rollups"]["agent_count"] == 3
    assert data["rollups"]["chart_count"] == 4
    assert data["rollups"]["recommendation_count"] == 5
    assert data["rollups"]["workload_unit_total"] == 91
    assert data["rollups"]["current_auto_execution_enabled_count"] == 0
    assert data["rollups"]["live_auto_optimization_count"] == 0
