// api/modules/video.ts
import { createRequestClient } from '../request'
import { SERVICE_MAP } from '../config'
import type { IApiResponse } from '../types'
import type { IVideoCheckResponse } from '@/types/video'
import { skeletonClient } from '@/api/clients'

/**
 * 视频相关API
 */
export const videoApi = {
  /**
   * 获取视频播放信息
   * 接口: sociology/course/checkVideo
   * 方法: POST
   */
  checkVideo(data: {
    id: number
  }) {
    return skeletonClient.request<IVideoCheckResponse>({
      url: 'sociology/course/checkVideo',
      method: 'POST',
      data
    })
  },

  /**
   * 保存播放进度
   * 接口: sociology/course/saveCoursePosition
   * 方法: POST
   */
  saveCoursePosition(data: {
    videoId: number
    position: number
  }) {
    return skeletonClient.request<IApiResponse>({
      url: 'sociology/course/saveCoursePosition',
      method: 'POST',
      data
    })
  },

  /**
   * 报告错误视频
   * 接口: medical/course/addErrorCourse
   * 方法: POST
   */
  addErrorCourse(data: {
    chapterId: number
    videoId: number
    sort: number
  }) {
    return skeletonClient.request<IApiResponse>({
      url: 'medical/course/addErrorCourse',
      method: 'POST',
      data
    })
  }
}
