import { http } from '../http'

const happyReadApi = {
  /**
   * 短片阅读、自然拼读答题结果记录
   */
  readingLearnRecord: (data: anyObj) =>
    http.request({
      url: '/readingLearnRecord/saveRecord',
      method: 'POST',
      data,
    }),

  // 自然拼读关卡-开始练习(智能选择关卡)
  getNaturalLangBeginTrain: () =>
    http.request({
      url: '/naturalLangLevel/getLevelContentById/beginTrain',
    }),

  // 句子单词关联-获取该单词关联关卡练习(若返回空则表示该单词没有相关关卡)
  getTestOrWordDetail: (data: anyObj) =>
    http.request({
      url: '/textSentenceWord/queryThroughLevelTrain',
      method: 'POST',
      data,
    }),

  /**
   * 短篇阅读
   */
  // 短篇阅读获取首页数据
  shortQueryFirstPageInfo: () =>
    http.request({
      url: '/shortTextReadingLevel/queryFirstPageInfo',
    }),

  // 短篇阅读开始练习
  shortReadBeginTrain: (params?: anyObj) =>
    http.request({
      url: '/shortTextReadingLevel/beginTrain',
      params,
    }),

  // sessionid 生成
  getReadSessionid: () =>
    http.request({
      url: '/shortTextReadingLevel/sessionIdSender',
    }),

  // 阶数选择
  getReadGradeList: () =>
    http.request({
      url: '/shortTextReadingLevel/gradleSelector',
    }),

  // 获取答题列表
  getReadRecoredList: (params?: anyObj) =>
    http.request({
      url: '/readingLearnRecord/list',
      params,
    }),

  // 获取答题详情
  getReadRecoredDetail: (params?: anyObj) =>
    http.request({
      url: '/shortTextReadingLevel/detailRecord',
      params,
    }),
}

export default happyReadApi
