import { get, post, put, del } from '../../http'
import type { Route } from '#/interfaces'

/**
 * @description: 获取书籍详情-读物页码列表
 * @param {*} params
 * @returns {*}
 */
export const getBookDetailList = async (params: Record<string, any>) => {
  return await get<any>('/book/getBookContent', params)
}

/**
 * @description: 新增书籍详情-新增读物
 * @param {*} data
 * @returns {*}
 */
export const addBookContent = async (data: Record<string, any>) => {
  return await post<any>('/book/addBookContent', data)
}

/**
 * @description: 删除书籍详情-删除读物
 * @param {*} data
 * @returns {*}
 */
export const handleDeleteDetail = async (data: Record<string, any>) => {
  return await post<any>('/book/deleteBookContent', data)
}

/**
 * @description: 更新书籍详情-更新读物状态
 * @param {*} data
 * @returns {*}
 */
export const handleUpdataDetail = async (data: Record<string, any>) => {
  return await put('/book/updateBookContentStatus', data)
}

/**
 * @description: 通过id查询书籍题目
 * @param {*} id
 * @returns {*}
 */
export const getTopicById = async (id: string) => {
  return await get<any>(`/bookQuiz/queryAllQuizByBookId/${id}`)
}

/**
 * @description: 新增书籍题目
 * @param {*} data
 * @returns {*}
 */
export const handleAddTopic = async (data: Record<string, any>) => {
  return await post<any>('/bookQuiz', data)
}

/**
 * @description: 更新书籍题目
 * @param {*} data
 * @returns {*}
 */
export const handleUpdataTopic = async (data: Record<string, any>) => {
  return await put('/bookQuiz', data)
}

/**
 * @description: 删除书籍题目
 * @param {*} data
 * @returns {*}
 */
export const handleDelTopicAPI = async (id: string) => {
  return await del(`/bookQuiz/${id}`)
}

/**
 * @description: 获取书页详情
 * @param {*} params
 * @returns {*}
 */
export const getBookContentDetail = async (params: Record<string, any>) => {
  return await get<any>('/book/getBookContentDetail', params)
}

/**
 * @description: 更新书页详情
 * @param {*} params
 * @returns {*}
 */
export const updateBookContent = async (data: Record<string, any>) => {
  return await post<any>('/book/updateBookContent', data)
}

/**
 * @description: 获取单词对应释义
 * @param {*} data
 * @returns {*}
 */
export const getMeaingDataApi = async (data: string) => {
  return await get<any>(`/book/getMeaningListBySpell/${data}`)
}
