import request from '/@/utils/request'

/**
 * 分页查询预约记录
 * @param query current, size, stuNo, classNo, reservationTime, isHandle
 */
export const fetchList = (query?: any) => {
  return request({
    url: '/stuwork/psychologicalcounselingreservation/page',
    method: 'get',
    params: query
  })
}

/**
 * 通过 id 查询预约记录详情
 * @param id
 */
export const getDetail = (id: string) => {
  return request({
    url: '/stuwork/psychologicalcounselingreservation/detail',
    method: 'get',
    params: { id }
  })
}

/**
 * 新增预约记录
 * @param data teacherNo, reservationTime, classNo, stuNo, stuName, phone, remarks, realName?, isHandle?
 */
export const addObj = (data: any) => {
  return request({
    url: '/stuwork/psychologicalcounselingreservation',
    method: 'post',
    data
  })
}

/**
 * 修改预约记录
 * @param data 含 id 及需修改字段
 */
export const editObj = (data: any) => {
  return request({
    url: '/stuwork/psychologicalcounselingreservation/edit',
    method: 'post',
    data
  })
}

/**
 * 通过 id 删除预约记录
 * @param ids id 数组
 */
export const delObj = (ids: string[]) => {
  return request({
    url: '/stuwork/psychologicalcounselingreservation/delete',
    method: 'post',
    data: ids
  })
}
