import $axios from '../index'

const videoApi = {
  videoTimelineApi: '/api/media/video/post/timeline',
  videoRecommendApi: '/api/media/video/post/recommend',
  videoTagApi: '/api/media/video/post/tag',
  similarVideoApi: '/api/media/video/post/similar',
  videoInfoApi: '/api/media/video/post/detail',
  videoUrlApi: '/api/media/video/url',
  videoCategoryApi: '/api/media/video/category',
  videoPostSubmitApi: '/api/media/video/post/submit',
  playerRecordApi: '/api/media/video/play/record',
  userVideoListApi: '/api/media/video/post/user'
}

// 视频时间线
export function videoTimeline(page) {
  return $axios.get(videoApi.videoTimelineApi + '/' + page)
}

// 视频推荐接口
export function videoRecommend(page) {
  return $axios.get(videoApi.videoRecommendApi + '/' + page)
}

// 视频标签接口
export function videoTag(tag, page) {
  return $axios.get(videoApi.videoTagApi + '?tag=' + tag + '&page=' + page)
}
// 相似视频接口
export function similarVideo(videoId) {
  return $axios.get(videoApi.similarVideoApi + '?videoId=' + videoId)
}

// 视频详情接口
export function videoInfo(videoId) {
  return $axios.get(videoApi.videoInfoApi + '/' + videoId)
}

// 视频 URL 接口
export function videoUrl(videoId) {
  return $axios.get(videoApi.videoUrlApi + '/' + videoId)
}

// 视频 URL 接口
export function videoCategory() {
  return $axios.get(videoApi.videoCategoryApi)
}

export function submitVideoPost(videoPost) {
  return $axios.post(videoApi.videoPostSubmitApi, videoPost)
}

// 播放记录
export function submitPlayRecord(playerRecord) {
  return $axios.post(videoApi.playerRecordApi, playerRecord)
}

// 用户视频列表
export function userVideoList(page, userId) {
  return $axios.get(videoApi.userVideoListApi + '?page=' + page + '&userId=' + userId)
}
