import {
  displayList,
  serialNumberTypeList,
  serialNumberPositionList,
  switchOption,
} from '@/views/book/courseware/data/common';
import { getRandomNumber } from '@/utils';
export { switchOption };

export function getVoiceMatrixProperty() {
  return {
    serial_number: 1,
    sn_type: serialNumberTypeList[0].value,
    sn_position: serialNumberPositionList[0].value,
    sn_display_mode: displayList[0].value,
    is_enable_row_play: switchOption[0].value, // 是否开启行播放
    is_enable_column_play: switchOption[0].value, // 是否开启列播放
    is_enable_record: switchOption[0].value, // 是否开启录音
    row_count: 2,
    column_count: 5,
  };
}

export function getOption() {
  return {
    content: '',
    mark: getRandomNumber(),
    lrc_data: {}, // lrc 数据
  };
}

export function getVoiceMatrixData() {
  return {
    type: 'voice_matrix',
    title: '语音矩阵',
    lrc_arr: [], // lrc 文件解析后的数据
    // lrc 文件数据
    lrc_data: {
      name: '',
      url: '',
      id: '',
      file_id: '',
    },
    // 音频文件数据
    audio_data: {
      name: '',
      media_duration: 0,
      temporary_url: '',
      url: '',
      file_id: '',
    },
    option_list: Array.from({ length: 2 }, () => Array.from({ length: 5 }, getOption)),
    record_list: [],
    min_height: 100,
    min_width: 300,
    property: getVoiceMatrixProperty(),
  };
}
