export interface PlanItem {
  order: number;
  finished: boolean;
  courseName: string;
  label: string;
  progressText: string;
  time: string;
  note: string;
  bgColor?: string;
}

export const TASK_TYPE = {
  '0': {
    label: '自由学',
    notePrefix: `观看学习视频：《#{chapterName}》章节《#{courseTimeName}》视频`,
    bgColor: '#FFA65D',
  },
  '1': {
    label: '自由学',
    notePrefix: '完成章节练习：《#{chapterName}》',
    bgColor: '#FFA65D',
  },
  '2': {
    label: '精准学',
    notePrefix: 'AI精准学#{finishedNum}次',
    bgColor: '#4FD6EE',
  },
  '3': {
    label: '语感训练',
    notePrefix: '语感训练#{finishedNum}次',
    bgColor: '#B4B3FF',
  },
  '4': {
    label: '错题本',
    notePrefix: '订正错题本#{finishedNum}道',
  },
};

export function formatTaskTypeNotePrefix(notePrefix, values, defaultValue = 0) {
  return notePrefix.replace(/#{(.*?)}/g, (match, key) => {
    return values[key] || defaultValue;
  });
}
