from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_runtime_worker_shadow_gate_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-runtime-worker-shadow-gate")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_runtime_worker_shadow_gate_v1"
    assert data["program_status"]["current_task_id"] == "P2-404"
    assert data["program_status"]["next_task_id"] == "P2-101"
    assert data["program_status"]["overall_completion_percent"] == 96
    assert data["shadow_gate_truth"]["shadow_worker_evidence_gate_ready"] is True
    assert data["shadow_gate_truth"]["gateway_queue_write_enabled"] is False
    assert data["shadow_gate_truth"]["telegram_send_enabled"] is False
    assert data["shadow_gate_truth"]["telegram_bot_api_call_enabled"] is False
    assert data["shadow_gate_truth"]["shadow_worker_live_enabled"] is False
    assert data["shadow_gate_truth"]["ai_runtime_worker_enabled"] is False
    assert data["shadow_gate_truth"]["production_write_enabled"] is False
    assert data["rollups"]["shadow_candidate_count"] == 5
    assert data["rollups"]["no_write_replay_count"] == 4
    assert data["rollups"]["verifier_shadow_case_count"] == 4
    assert data["rollups"]["agent_role_count"] == 3
    assert data["rollups"]["operator_checkpoint_count"] == 6
    assert data["rollups"]["shadow_worker_live_run_count"] == 0
    assert data["rollups"]["gateway_queue_write_count"] == 0
    assert data["rollups"]["telegram_send_count"] == 0
    assert data["rollups"]["telegram_bot_api_call_count"] == 0
    assert data["rollups"]["production_write_count"] == 0
