def get_advisor_prompt(report_data: dict, user_message: str, language: str = "ar") -> list:
    lang_instruction = "Respond entirely in Arabic." if language == "ar" else "Respond entirely in English."
    
    context_parts = []
    if isinstance(report_data, dict):
        for key in ["project_description", "executive_summary", "market_analysis_summary",
                     "financial_analysis_summary", "competitive_analysis_summary",
                     "verdict", "verdict_explanation", "final_verdict"]:
            val = report_data.get(key, "")
            if val:
                context_parts.append(f"{key}: {val}")
        
        fh = report_data.get("financial_highlights", {})
        if isinstance(fh, dict):
            context_parts.append(f"Financial Highlights: {fh}")
        
        swot = report_data.get("swot", {})
        if isinstance(swot, dict):
            context_parts.append(f"SWOT: {swot}")

    context = "\n".join(context_parts)

    return [
        {
            "role": "system",
            "content": (
                "You are Jadwa AI Advisor, an expert business consultant. "
                "You have access to a full feasibility study report for a business idea. "
                "Answer the user's questions based on the report data below. "
                "Be concise, practical, and actionable. "
                "If the user asks something outside the report scope, provide general business advice. "
                f"{lang_instruction}\n\n"
                f"## Feasibility Report Data:\n{context}"
            ),
        },
        {
            "role": "user",
            "content": user_message,
        },
    ]
