import request from '@/api/request.js'

const INTELLIGENT_TRANSLATION_BASE_URL = '/doc-detail-pdf-api'
const INTELLIGENT_TRANSLATION_HEADERS = {
  'Client-ID': 'test_client',
  'X-API-Key': 'test_key'
}

export function submitTranslationTask(file) {
  const formData = new FormData()
  formData.append('files', file)
  return request({
    url: `${INTELLIGENT_TRANSLATION_BASE_URL}/submit`,
    method: 'POST',
    data: formData,
    headers: INTELLIGENT_TRANSLATION_HEADERS
  })
}

export function queryTranslationTaskStatus(taskId) {
  return request({
    url: `${INTELLIGENT_TRANSLATION_BASE_URL}/status/${taskId}`,
    method: 'GET',
    headers: INTELLIGENT_TRANSLATION_HEADERS
  })
}

export function queryTranslationTaskResult(taskId) {
  return request({
    url: `${INTELLIGENT_TRANSLATION_BASE_URL}/result/${taskId}`,
    method: 'GET',
    headers: INTELLIGENT_TRANSLATION_HEADERS
  })
}
