from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_post_write_verifier_package_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-post-write-verifier-package")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_post_write_verifier_package_v1"
    assert data["program_status"]["current_task_id"] == "P2-403H"
    assert data["program_status"]["next_task_id"] == "P2-403I"
    assert data["program_status"]["overall_completion_percent"] == 97
    assert data["verifier_truth"]["runtime_write_allowed"] is False
    assert data["verifier_truth"]["post_write_verifier_implemented"] is False
    assert data["verifier_truth"]["post_write_verifier_executed_count"] == 0
    assert data["verifier_truth"]["rollback_work_item_created_count"] == 0
    assert data["rollups"]["verification_target_count"] == 4
    assert data["rollups"]["failure_lane_count"] == 3
    assert data["rollups"]["operator_action_count"] == 4
    assert data["rollups"]["live_verifier_execution_count"] == 0
