import http from '@/api'
import { MaintenanceRecordVO, MaintenanceRecordForm, MaintenanceRecordQuery } from '@/api/interface/als/maintenanceRecord'
/**
 * @name 查询维修记录列表
 * @param query 参数
 * @returns 返回列表
 */
export const listMaintenanceRecordApi = (query: MaintenanceRecordQuery) => {
  return http.get<MaintenanceRecordVO[]>('/als/maintenanceRecord/list', query, { loading: false })
}

/**
 * @name 查询维修记录详细
 * @param id id
 * @returns returns
 */
export const getMaintenanceRecordApi = (id: string | number) => {
  return http.get<MaintenanceRecordVO>(`/als/maintenanceRecord/${id}`)
}

/**
 * @name 新增维修记录
 * @param data data
 * @returns returns
 */
export const addMaintenanceRecordApi = (data: MaintenanceRecordForm) => {
  return http.post<any>('/als/maintenanceRecord', data, { loading: false })
}

/**
 * @name 修改维修记录
 * @param data data
 * @returns returns
 */
export const updateMaintenanceRecordApi = (data: MaintenanceRecordForm) => {
  return http.put<any>('/als/maintenanceRecord', data, { loading: false })
}

/**
 * @name 删除维修记录
 * @param id id
 * @returns returns
 */
export const delMaintenanceRecordApi = (id: string | number | Array<string | number>) => {
  return http.delete<any>(`/als/maintenanceRecord/${id}`)
}

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

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

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