import http from '@/api'

/**
 * @name 查询OSS对象存储列表
 * @param query 参数
 * @returns 返回列表
 */
export const listOssApi = (query: any) => {
  return http.get<any>('/resource/oss/list', query, { loading: true })
}

/**
 * @name 查询OSS对象存储详细
 * @param ossId ossId
 * @returns returns
 */
export const getOssApi = (ossId: any) => {
  return http.get<any>(`/resource/oss/${ossId}`)
}
/**
 * @name 查询OSS对象基于id串
 * @param ossId ossId
 * @returns returns
 */
export const getListByIdsApi = (ossIds: any) => {
  return http.get<any>(`/resource/oss/listByIds/${ossIds}`)
}

/**
 * @name 新增OSS对象存储
 * @param data data
 * @returns returns
 */
export const addOssApi = (data: any) => {
  return http.post<any>('/resource/oss', data, { loading: false })
}

/**
 * @name 修改OSS对象存储
 * @param data data
 * @returns returns
 */
export const updateOssApi = (data: any) => {
  return http.put<any>('/resource/oss', data, { loading: false })
}

/**
 * @name 删除OSS对象存储
 * @param ossId ossId
 * @returns returns
 */
export const delOssApi = (ossId: any) => {
  return http.delete<any>(`/resource/oss/${ossId}`)
}

/**
 * @name 下载模板
 * @returns returns
 */
export const importTemplateApi = () => {
  return http.downloadPost('/resource/oss/importTemplate', {})
}

/**
 * @name 导入数据
 * @returns returns
 */
export const importOssDataApi = (data: any) => {
  return http.post('/resource/oss/importData', data)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const exportOssApi = (data: any) => {
  return http.downloadPost('/resource/oss/export', data)
}
