from typing import Dict
from typing import Any
from typing import List


async def get_sorted_agenda_items(
    agenda_items: Dict[int, Dict[str, Any]]
) -> List[Dict[str, Any]]:
    """
    Returns all sorted agenda items by id first and then weight, resulting in
    ordered items, if some have the same weight.
    """
    return sorted(
        sorted(agenda_items.values(), key=lambda item: item["id"]),
        key=lambda item: item["weight"],
    )