import request from '@/utils/request'

// 查询课程表列表
export function listLearningTable(query) {
  return request({
    url: '/api/v3/schedule/list',
    method: 'get',
    params: query
  })
}

// 新增课程表
export function addLearningTable(data) {
  return request({
    url: '/api/v3/schedule',
    method: 'post',
    data: data
  })
}

// 修改课程表
export function updateLearningTable(data, id) {
  return request({
    url: '/api/v3/schedule/' + id,
    method: 'put',
    data: data
  })
}

// 批量删除课程表
export function delLearningTable(query) {
  return request({
    url: '/api/v3/schedule/batch',
    method: 'delete',
    params: query
  })
}

//根据id获取单个课程表
export function getLearningTable(id) {
  return request({
    url: '/api/v3/schedule/' + id,
    method: 'get'
  })
}

//通过分类获取所有课程  /api/v3/course/list/searchByCategory

export function getCategoryByCourse() {
  return request({
    url: '/api/v3/course/list/searchByCategory',
    method: 'get'
  })
}

//根据查询关键字获取课程

// export function getFilterByCourse(query) {
//   return request({
//     url: '/api/v3/course/list',
//     method: 'get',
//     params: query
//   })
// }
//根据查询关键字获取课程 /api/v3/course/list/searchByTitle?title=py&order=asc&orderBy=create_time
export function getFilterByCourse(query) {
  return request({
    url: '/api/v3/course/list/searchByTitle',
    method: 'get',
    params: query
  })
}
// 获取某个课程表副本模板 /api/v3/schedule/:scheduleID/copy/template
export function getLearningTableCopy(id) {
  return request({
    url: '/api/v3/schedule/' + id + '/copy/template',
    method: 'get'
  })
}
