import http from '@/api'
import { FaultCaseVO, FaultCaseForm, FaultCaseQuery } from '@/api/interface/als/faultCase'
/**
 * @name 查询故障案例列表
 * @param query 参数
 * @returns 返回列表
 */
export const listFaultCaseApi = (query: FaultCaseQuery) => {
  return http.get<FaultCaseVO[]>('/als/faultCase/list', query, { loading: false })
}

/**
 * @name 查询故障案例详细
 * @param id id
 * @returns returns
 */
export const getFaultCaseApi = (id: string | number) => {
  return http.get<FaultCaseVO>(`/als/faultCase/${id}`)
}

/**
 * @name 新增故障案例
 * @param data data
 * @returns returns
 */
export const addFaultCaseApi = (data: FaultCaseForm) => {
  return http.post<any>('/als/faultCase', data, { loading: false })
}

/**
 * @name 修改故障案例
 * @param data data
 * @returns returns
 */
export const updateFaultCaseApi = (data: FaultCaseForm) => {
  return http.put<any>('/als/faultCase', data, { loading: false })
}

/**
 * @name 删除故障案例
 * @param id id
 * @returns returns
 */
export const delFaultCaseApi = (id: string | number | Array<string | number>) => {
  return http.delete<any>(`/als/faultCase/${id}`)
}

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

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

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