import BaseStore from '@src/stores/base';

export default class SentenceStore extends BaseStore {
  /**
   * 所有长难句信息
   */
  getInfo() {
    return this.apiGet('/sentence/info');
  }

  /**
   * 激活长难句
   * @param {*} code
   */
  active(code) {
    return this.apiPut('/sentence/active', { code });
  }

  /**
   * 文章列表
   * @param {*} chapter
   */
  listArticle() {
    return this.apiGet('/sentence/article/list');
  }

  /**
   * 获取文章详情
   * @param {*} articleId
   */
  detailArticle(articleId) {
    return this.apiGet('/sentence/article/detail', { articleId });
  }

  /**
   * 更新长难句文章进度
   * @param {*} chapter
   * @param {*} part
   * @param {*} progress
   * @param {*} time
   * @param {*} currentChapter
   * @param {*} currentPart
   */
  updateProgress(chapter, part, progress, time, currentChapter, currentPart) {
    return this.apiPut('/sentence/article/progress', { chapter, part, progress, time, currentChapter, currentPart });
  }

  /**
   * 获取练习卷
   */
  listPaper() {
    return this.apiGet('/sentence/paper/list');
  }
}

export const Sentence = new SentenceStore({ key: 'sentence' });