import httpRequest from '@/utils/axios'
import type {
  BookAuthorizeCreateItem,
  CaseAuthorizeCreateItem,
  VideoAuthorizeCreateItem,
  VideoUploadAuthParams,
  VideoUploadRefreshParams,
} from './types'

// 获取课程列表
export function getCourseList() {
  return httpRequest.get('/api/lab/v1/teacher/course/list')
}

// 获取实验列表
export function getExperimentList(params: { course_id: string }) {
  return httpRequest.get('/api/resource/v1/backend/experiment/experiments', { params })
}

// 创建案例原文
export function createCase(data: CaseAuthorizeCreateItem) {
  return httpRequest.post('/api/lab/v1/teacher/experiment-cases/create', data)
}

// 创建指导书
export function createBook(data: BookAuthorizeCreateItem) {
  return httpRequest.post('/api/lab/v1/teacher/book/create', data)
}

// 创建操作视频
export function createVideo(data: VideoAuthorizeCreateItem) {
  return httpRequest.post('/api/lab/v1/teacher/video/create', data)
}

// 获取上传视频凭证
export function getUploadVideoAuth(data: VideoUploadAuthParams) {
  return httpRequest.post('/api/lab/v1/teacher/video/auth-create', data)
}

// 刷新上传视频地址凭证
export function updateUploadVideoAuth(data: VideoUploadRefreshParams) {
  return httpRequest.post('/api/lab/v1/teacher/video/create-auth', data)
}
