from fastapi.testclient import TestClient

from src.main import app


def test_get_ai_agent_learning_writeback_approval_package_api():
    client = TestClient(app)
    response = client.get("/api/v1/agents/agent-learning-writeback-approval-package")

    assert response.status_code == 200
    data = response.json()
    assert data["schema_version"] == "ai_agent_learning_writeback_approval_package_v1"
    assert data["program_status"]["current_task_id"] == "P2-403D"
    assert data["program_status"]["next_task_id"] == "P2-403E"
    assert data["learning_truth"]["km_write_allowed"] is False
    assert data["learning_truth"]["telegram_send_allowed"] is False
    assert data["rollups"]["live_write_count_total"] == 0
