"""
Roadmap generator for project status documentation.
"""

from typing import Dict, Any, List, Optional


def generate_roadmap(
    milestones: Dict[str, Dict[str, Any]],
    roadmap_items: Dict[str, List[Dict[str, Any]]],
) -> List[Dict[str, Any]]:
    """Generate roadmap from milestones and roadmap items."""
    roadmap = []

    # Process each milestone
    for milestone_key, milestone_data in milestones.items():
        # Create milestone entry
        milestone = {
            "name": milestone_key.replace("_", " ").title(),
            "target_date": milestone_data.get("last_date", "TBD"),
            "items": [],
        }

        # Add roadmap items for this milestone
        if milestone_key in roadmap_items:
            for item in roadmap_items[milestone_key]:
                milestone["items"].append(
                    {"description": item["description"], "status": "planned"}
                )

        roadmap.append(milestone)

    return roadmap
