import type { DifficultyLevel } from '../models/worksheet';

/** 产品文档：难度 入门 / 基础 / 进阶 / 挑战 → 云库 difficulty 1–4 */
export const DIFFICULTY_LEVEL_TO_STARS: Record<
    DifficultyLevel,
    1 | 2 | 3 | 4
> = {
    beginner: 1,
    basic: 2,
    intermediate: 3,
    advanced: 4,
};

export const STARS_TO_DIFFICULTY_LEVEL: Record<
    1 | 2 | 3 | 4,
    DifficultyLevel
> = {
    1: 'beginner',
    2: 'basic',
    3: 'intermediate',
    4: 'advanced',
};

export function difficultyToStars(
    level?: DifficultyLevel,
): 1 | 2 | 3 | 4 {
    return level ? DIFFICULTY_LEVEL_TO_STARS[level] : 2;
}

/** 分龄 Tab / 筛选（现有功能清单 + 产品设计 3-8 岁） */
export const AGE_BANDS = [
    { key: '3-4', minAge: 3, maxAge: 4, label: '3-4 岁' },
    { key: '4-5', minAge: 4, maxAge: 5, label: '4-5 岁' },
    { key: '5-6', minAge: 5, maxAge: 6, label: '5-6 岁' },
    { key: '6-7', minAge: 6, maxAge: 7, label: '6-7 岁' },
    { key: '7-8', minAge: 7, maxAge: 8, label: '7-8 岁' },
] as const;

export type AgeBandKey = (typeof AGE_BANDS)[number]['key'];
