def classify_winning_number(number_text):
    text = str(number_text or "").strip()
    if len(text) != 3 or (not text.isdigit()):
        return "normal"
    unique_count = len(set(text))
    if unique_count == 1:
        return "baozi"
    if unique_count == 2:
        return "group3"
    return "normal"


def build_winning_number_style_bundle(
    PatternFill,
    Font,
    *,
    font_name="Songti",
    font_size=14,
    font_bold=False,
    group3_fill_color="FFFF00",
    baozi_fill_color="FF0000",
    baozi_font_color="FFFF00",
):
    return {
        "group3_fill": PatternFill(fill_type="solid", fgColor=group3_fill_color),
        "baozi_fill": PatternFill(fill_type="solid", fgColor=baozi_fill_color),
        "baozi_font": Font(
            name=font_name,
            size=font_size,
            bold=font_bold,
            color=baozi_font_color,
        ),
    }


def apply_winning_number_highlight(cell, number_text, style_bundle):
    number_type = classify_winning_number(number_text)
    if number_type == "baozi":
        cell.fill = style_bundle["baozi_fill"]
        cell.font = style_bundle["baozi_font"]
    elif number_type == "group3":
        cell.fill = style_bundle["group3_fill"]
    return number_type
