import request from '@/utils/request'

/**
 * 上传视频到腾讯广告
 * @param {FormData} formData 表单数据（包含file, accountId, hasWatermark, dramaId, watermarkDuration, description）
 */
export function uploadVideo(formData) {
  return request({
    timeout: 300000,
    url: '/api/tencent-video/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

/**
 * 分页查询视频列表
 * @param {Number} page 页码
 * @param {Number} size 每页数量
 * @param {Number} accountId 账户ID
 * @param {String} uploadStatus 上传状态
 */
export function getVideoList(page = 1, size = 10, accountId = null, uploadStatus = null) {
  return request({
    url: '/api/tencent-video/list',
    method: 'get',
    params: { page, size, accountId, uploadStatus }
  })
}

/**
 * 查询视频详情
 * @param {Number} id 视频ID
 */
export function getVideoDetail(id) {
  return request({
    url: `/api/tencent-video/${id}`,
    method: 'get'
  })
}

/**
 * 删除视频记录
 * @param {Number} id 视频ID
 */
export function deleteVideo(id) {
  return request({
    url: `/api/tencent-video/${id}`,
    method: 'delete'
  })
}
