# -*- coding: utf-8 -*-
"""Course levels 1-12 (Level N = Grade N, age N + 5). The existing workbook is Level 2; the others are coming soon.
To open a level: give its units level=<id> in curriculum.py and set available=True here."""

NAMES_AR = ["الأول", "الثاني", "الثالث", "الرابع", "الخامس", "السادس", "السابع", "الثامن", "التاسع", "العاشر", "الحادي عشر", "الثاني عشر"]
ICONS = ["🌱", "🔬", "🧲", "🌋", "🔭", "⚗️", "🧬", "⚡", "🌍", "🧪", "🛰️", "⚛️"]
COLORS = ["#66bb6a", "#29b6f6", "#ab47bc", "#ef6c00", "#5c6bc0", "#26a69a", "#ec407a", "#fbc02d", "#8d6e63", "#00838f", "#455a64", "#6a1b9a"]
DEFAULT = 2          # the level of the existing course; new kids start here


def band_of(age):
    if not age or age <= 9:
        return "kids"
    return "junior" if age <= 12 else "teen"


LEVELS = [dict(id=n, available=(n == 2), age=n + 5, icon=ICONS[n - 1], color=COLORS[n - 1], band=band_of(n + 5),
               title_ar=f"المستوى {NAMES_AR[n - 1]}", title_fr=f"Level {n}",
               book="Science Grade 2 — Workbook" if n == 2 else "",
               desc_ar="النباتات والإنسان والمادة والقوى والأرض والسماء" if n == 2 else "قريباً",
               desc_fr="Plants, people, matter, forces, Earth and the sky" if n == 2 else "Coming soon") for n in range(1, 13)]
AVAILABLE = [l["id"] for l in LEVELS if l["available"]]


def level(level_id):
    return next((l for l in LEVELS if l["id"] == level_id), None)
