/**
 * 题目类型
 */
export const questionTypes = [
  { label: '单选题', value: 'single_choice' },
  { label: '多选题', value: 'multiple_choice' },
  { label: '填空题', value: 'fill_blank' },
  { label: '简答题', value: 'essay' },
  { label: '判断题', value: 'judgment' },
]

// 试题难度选项 easy-简单、medium-中等、hard-困难
export const difficultyOptions = [
  { label: '简单', value: 'easy', color: '' },
  { label: '中等', value: 'medium', color: 'yellow' },
  { label: '困难', value: 'hard', color: 'red' },
]

// p=pending-待发布、ongoing-已发布、finished-已结束、cancelled-已关闭
export const examStatusOptions = [
  { label: '已发布', value: 'ongoing', color: 'success' },
  { label: '待发布', value: 'pending', color: 'primary' },
  { label: '已关闭', value: 'cancelled', color: 'danger' },
  { label: '已结束', value: 'finished', color: 'info' },
]

export const reviewStatusOptions = [
  { label: '待批改', value: 'unreviewed', color: '#EB5E12' },
  { label: '批改中', value: 'reviewing', color: '#FFC107' },
  { label: '已批改', value: 'reviewed', color: '#38B865' },
]

export const taskLevelOptions = [
  { label: '常规', value: 0, color: '#409EFF' },
  { label: '选做', value: 1, color: '#E6A23C' },
  { label: '必做', value: 2, color: '#67C23A' },
]

export const taskStatusOptions: any = [
  { label: '已取消', value: 0, color: '#409EFF' },
  { label: '待处理', value: 1, color: '#E6A23C' },
  { label: '超期未处理', value: 2, color: '#F56C6C' },
  { label: '已处理', value: 3, color: '#909399' },
]

export const authStatusOptions = [
  { label: '可授权', value: 0, color: '#215ACD' },
  { label: '已授权', value: 1, color: '#339169' },
  { label: '被授权', value: 2, color: '#EB5E12' },
]

export function getLabel(dict: any[], value: string) {
  const item = dict.find(item => item.value === value)
  return item?.label || value
}
