import request from '@/utils/request'

// 查询课堂视频列表
export function listUserCourseVideo(query) {
  return request({
    url: '/course/userCourseVideo/list',
    method: 'get',
    params: query
  })
}

// 查询课堂视频详细
export function getUserCourseVideo(videoId) {
  return request({
    url: '/course/userCourseVideo/' + videoId,
    method: 'get'
  })
}

export function getSort(courseId) {
  return request({
    url: '/course/userCourseVideo/getSort/' + courseId,
    method: 'get'
  })
}

// 新增课堂视频
export function addUserCourseVideo(data) {
  return request({
    url: '/course/userCourseVideo',
    method: 'post',
    data: data
  })
}
// 新增课堂视频
export function updates(data) {
  return request({
    url: '/course/userCourseVideo/updates',
    method: 'post',
    data: data
  })
}

// 新增课堂视频
export function batchSaveVideo(data) {
  return request({
    url: '/course/userCourseVideo/batchSaveVideo',
    method: 'post',
    data: data
  })
}
// 新增课堂视频
export function batchUpdateRed(data) {
  return request({
    url: '/course/userCourseVideo/batchUpdateRed',
    method: 'post',
    data: data
  })
}

// 修改课堂视频
export function updateUserCourseVideo(data) {
  return request({
    url: '/course/userCourseVideo',
    method: 'put',
    data: data
  })
}

// 删除课堂视频
export function delUserCourseVideo(videoId) {
  return request({
    url: '/course/userCourseVideo/' + videoId,
    method: 'delete'
  })
}

// 同步课程模板
export function syncTemplate(courseId) {
  console.log(courseId)
  return request({
    url: '/course/userCourse/syncTemplate/' + courseId,
    method: 'post'
  })
}

// 导出课堂视频
export function exportUserCourseVideo(query) {
  return request({
    url: '/course/userCourseVideo/export',
    method: 'get',
    params: query
  })
}


export function getVideoListByCourseIdAll(courseId) {
  return request({
    url: '/course/userCourseVideo/getVideoListByCourseIdAll',
    method: 'get',
    params: {courseId}
  })
}

export function getVideoListByCourseId(query) {
  return request({
    url: '/course/userCourseVideo/getVideoListByCourseId',
    method: 'get',
    params: query
  })
}

export function sortCourseVideo(list) {
  return request({
    url: '/course/userCourseVideo/sortCourseVideo',
    method: 'post',
    data: list
  })
}


// 获取选项列表
export function getVideoListLikeName(query) {
  return request({
    url: '/course/userCourseVideo/getVideoListLikeName',
    method: 'get',
    params: query
  })
}

export function getChooseCourseVideoList(query) {
  return request({
    url: '/course/userCourseVideo/getChooseCourseVideoList',
    method: 'get',
    params: query
  })
}

// 下架课堂视频
export function batchDownUserCourseVideo(videoId) {
  return request({
    url: '/course/userCourseVideo/batchDown/' + videoId,
    method: 'post'
  })
}

// 修改视频封面
export function batchEditCover(data) {
  return request({
    url: '/course/userCourseVideo/batchEditCover',
    method: 'post',
    data: data
  })
}


