from services.ai_router import ask_ai


def evaluate_writing(essay, task=2):
    prompt = f"""
You are a certified IELTS writing examiner.

Evaluate this Task {task} essay using official IELTS band descriptors.

Essay:
{essay}

Return:
- overall band
- Task Achievement score
- Coherence and Cohesion score
- Lexical Resource score
- Grammar score
- mistakes
- vocabulary upgrades
- grammar corrections
- rewritten sample answer
- improvement plan
"""
    return ask_ai(prompt)
