import axios from '@/common/services/axios-instance'

class AttachmentService {
  largeFileInfo(data) {
    return axios.post('api/framework/v1/large-file/info', data).then((res) => res.data)
  }

  largeFileUpload(data) {
    return axios.post('api/framework/v1/large-file/upload', data).then((res) => res.data)
  }

  largeFileCancelUpload(fileId) {
    return axios
      .post('api/framework/v1/large-file/cancel-upload?fileId=' + fileId)
      .then((res) => res.data)
  }

  largeFileDeleteUpload(fileId) {
    return axios.delete(`api/framework/v1/large-file/${fileId}`).then((res) => res.data)
  }

  largeFileUploadComplete(fileId) {
    return axios
      .post('api/framework/v1/large-file/upload-complete?fileId=' + fileId)
      .then((res) => res.data)
  }

  largeFiledownload(fileId) {
    return axios.get('api/framework/v1/large-file/download/' + fileId).then((res) => res.data)
  }

  getlargeFiles(fileId) {
    return axios
      .get('api/framework/v1/large-file/attachments-info-perm/' + fileId)
      .then((res) => res.data)
  }
}

export default new AttachmentService()
