import request from '@/utils/request'

// 查询课程列表
export function listUserCourse(query) {
  return request({
    url: '/course/userCourse/list',
    method: 'get',
    params: query
  })
}

// 查询课程列表
export function publicListUserCourse(query) {
  return request({
    url: '/course/userCourse/publicList',
    method: 'get',
    params: query
  })
}

// 查询课程详细
export function getUserCourse(courseId) {
  return request({
    url: '/course/userCourse/' + courseId,
    method: 'get'
  })
}

// 新增课程
export function addUserCourse(data) {
  return request({
    url: '/course/userCourse',
    method: 'post',
    data: data
  })
}

// 修改课程
export function updateUserCourse(data) {
  return request({
    url: '/course/userCourse',
    method: 'put',
    data: data
  })
}

export function publicEditCompany(data) {
  return request({
    url: '/course/userCourse/publicEditCompany',
    method: 'post',
    data: data
  })
}


export function publicRemoveEditCompany(data) {
  return request({
    url: '/course/userCourse/publicRemoveEditCompany',
    method: 'post',
    data: data
  })
}

//统一修改课程红包
export function updateUserCourseRedPage(data) {
  return request({
    url: '/course/userCourse/editRedPage',
    method: 'post',
    data: data
  })
}


// 删除课程
export function delUserCourse(courseId) {
  return request({
    url: '/course/userCourse/' + courseId,
    method: 'delete'
  })
}

// 复制课程
export function copyUserCourse(courseId) {
  return request({
    url: '/course/userCourse/copy/' + courseId,
    method: 'get'
  })
}

// 导出课程
export function exportUserCourse(query) {
  return request({
    url: '/course/userCourse/export',
    method: 'get',
    params: query
  })
}

export function getAllCourse() {
  return request({
    url: '/course/userCourse/getAllList',
    method: 'get'
  })
}


export function updateIsShow(data) {
  return request({
    url: '/course/userCourse/updateIsShow',
    method: 'post',
    data: data
  })
}

export function putOn(courseIds) {
  return request({
    url: '/course/userCourse/putOn/' + courseIds,
    method: 'post'
  })
}
export function pullOff(courseIds) {
  return request({
    url: '/course/userCourse/pullOff/' + courseIds,
    method: 'post'
  })
}

// 修改课堂配置
export function editConfig(data) {
  return request({
    url: '/course/userCourse/editConfig',
    method: 'post',
    data: data
  })
}
