/** 自我检测：题目数量（0 / 5 / 10 / 15 …） */
export const COUNT_OPTIONS = Array.from({ length: 11 }, (_, i) => {
  const n = i * 5;
  return { id: n, fullName: `${n}条` };
});

/** 自我检测难度（与老系统一致，带颜色） */
export type SelfTestDifficulty = 'veryEasy' | 'easier' | 'normal' | 'harder' | 'veryHard';

export const SELF_TEST_DIFFICULTY_OPTIONS: {
  id: SelfTestDifficulty;
  fullName: string;
  color: string;
}[] = [
  { id: 'veryEasy', fullName: '很容易', color: '#52c41a' },
  { id: 'easier', fullName: '较容易', color: '#1890ff' },
  { id: 'normal', fullName: '一般', color: '#000000' },
  { id: 'harder', fullName: '较难', color: '#fa8c16' },
  { id: 'veryHard', fullName: '非常难', color: '#f5222d' },
];

/** 自我检测难度 → 试题 difficulty 字典值（easy/normal/hard） */
export const SELF_TEST_DIFFICULTY_TO_QUESTION: Record<SelfTestDifficulty, string[]> = {
  veryEasy: ['easy', 'veryEasy'],
  easier: ['easy', 'easier'],
  normal: ['normal'],
  harder: ['hard', 'harder'],
  veryHard: ['hard', 'veryHard'],
};

export function colorOfSelfTestDifficulty(v?: string) {
  return SELF_TEST_DIFFICULTY_OPTIONS.find((x) => x.id === v)?.color ?? '#000';
}

export function labelOfSelfTestDifficulty(v?: string) {
  return SELF_TEST_DIFFICULTY_OPTIONS.find((x) => x.id === v)?.fullName ?? v ?? '-';
}
