import fetch from '@/utils/fetch'

/**
 * 【查】-获取我的提问列表
 * @param {number} page
 * @param {number} pageSize
 * @returns
 */
export const getMyIssuesAPI = (data) => {
  return fetch({ url: `online-issues?page=${data.page}&pageSize=${data.pageSize}`, method: 'get' })
}

/**
 * 【查】-获取我的回答
 * @param {number} page
 * @param {number} pageSize
 * @returns
 */
export const getMyAnswerAPI = (data) => {
  return fetch({ url: `online-issues/my-answer?page=${data.page}&pageSize=${data.pageSize}`, method: 'get' })
}

/**
 * 【增】-新建问题
 * @param {string} title
 * @param {string} content
 * @param {Array} answerPersonIds
 * @returns
 */
export const createIssuesAPI = (data) => {
  return fetch({ url: 'online-issues', method: 'post', data })
}

/**
 * 【改】-编辑问题
 * @param {string} title
 * @param {string} content
 * 当前解答人的id
 * @param {Array} answerPersonIds
 * 保存过要删除的id
 * @param {Array} delAnswerPersonIds
 * @returns
 */
export const editorIssuesAPI = (data) => {
  return fetch({ url: 'online-issues/update-issues', method: 'post', data })
}

/**
 * 【改】- 回复问题
 * @param {string} id
 * @param {string} content
 * @returns
 */
export const answerAPI = (data) => {
  return fetch({ url: 'online-issues/answer', method: 'post', data })
}

/**
 * 【查】-
 * @param {string} id
 * @returns看。l
 */
export const getIssuesInfo = (id) => {
  return fetch({ url: `online-issues/${id}`, method: 'get' })
}

/**
*【查】-当前用户老师管理的学生
*/
export const getMyTeacherStudentAPI = () => {
  return fetch({ url: 'online-issues/myteacher', method: 'get' })
}
