import {
  displayList,
  serialNumberTypeList,
  serialNumberPositionList,
  arrangeTypeList,
  switchOption,
  isEnable,
} from '@/views/book/courseware/data/common';

export { arrangeTypeList, switchOption, isEnable };

export const wordShowList = [
  { value: 'true', label: '是' },
  { value: 'false', label: '否' },
];

export const inforList = [
  { value: 'true', label: '有' },
  { value: 'false', label: '没有' },
];

// 拼音位置
export const pinyinPositionList = [
  { value: 'front', label: '前面' },
  { value: 'back', label: '后面' },
  { value: 'top', label: '上面' },
  { value: 'bottom', label: '下面' },
];

// 读音生成方式
export const audioGenerationMethodList = [
  {
    value: 'upload',
    label: '上传',
  },
  {
    value: 'auto',
    label: '自动生成',
  },
  {
    value: 'record',
    label: '录音',
  },
];

export function getOption() {
  return {
    number: '',
    new_word: '',
    cixing: '', // 词性
    definition_list: '', // 需要增加词性
    pinyin: '',
    mp3_list: '',
    collocation: '', // 搭配
    liju_list: '', // 例句
  };
}
export function getNewWordProperty() {
  return {
    serial_number: 1,
    sn_type: serialNumberTypeList[0].value,
    sn_position: serialNumberPositionList[0].value,
    sn_display_mode: displayList[0].value,
    audio_generation_method: audioGenerationMethodList[0].value,
    pinyin_position: pinyinPositionList[0].value,
    is_word_show: wordShowList[1].value,
    is_has_infor: inforList[0].value,
  };
}

export function getNewWordData() {
  return {
    type: 'new_word',
    title: '生词组件',
    property: getNewWordProperty(),
    title_con: '',
    option: [getOption()],
    lrc_arr: [], // lrc 文件解析后的数据
    // lrc 文件数据
    lrc_data: {
      name: '',
      url: '',
      id: '',
      file_id: '',
    },
    // 音频文件数据
    audio_data: {
      name: '',
      media_duration: 0,
      temporary_url: '',
      url: '',
      file_id: '',
    },
    answer: {
      answer_list: [],
    },
  };
}
