from app.models.user import SchoolLevel

SCHOOL_LEVEL_LABELS: dict[SchoolLevel, str] = {
    SchoolLevel.junior_high: "初中",
    SchoolLevel.senior_high: "高中",
}


def school_level_label(level: SchoolLevel | str | None) -> str:
    if level is None:
        return "初中"
    if isinstance(level, str):
        try:
            level = SchoolLevel(level)
        except ValueError:
            return "初中"
    return SCHOOL_LEVEL_LABELS.get(level, "初中")
