from __future__ import annotations

from fastapi.testclient import TestClient

from src.main import app


def test_release_authorization_hold_endpoint() -> None:
    client = TestClient(app)

    response = client.get("/api/v1/agents/agent-result-capture-release-authorization-hold")

    assert response.status_code == 200
    payload = response.json()
    assert payload["schema_version"] == "ai_agent_result_capture_release_authorization_hold_v1"
    assert payload["program_status"]["current_task_id"] == "P2-134"
    assert payload["program_status"]["next_task_id"] == "P2-135"
    assert payload["program_status"]["overall_completion_percent"] == 100
    assert payload["program_status"]["runtime_authority"] == "result_capture_release_authorization_hold_only_no_live_write"
    assert payload["rollups"]["release_authorization_hold_count"] == 5
    assert payload["rollups"]["rollback_authorization_hold_count"] == 5
    assert payload["rollups"]["release_window_hold_count"] == 5
    assert payload["rollups"]["live_apply_authorization_hold_count"] == 5
    assert payload["rollups"]["blocked_authorization_transition_count"] == 6
    assert payload["rollups"]["operator_action_count"] == 5
    assert payload["rollups"]["owner_release_authorized_count"] == 0
    assert payload["rollups"]["release_authorization_granted_count"] == 0
    assert payload["rollups"]["gateway_queue_write_count"] == 0
    assert payload["rollups"]["telegram_send_count"] == 0
    assert payload["rollups"]["production_write_count"] == 0
