import http from '@/api'
import { MaintenanceTaskVO, MaintenanceTaskForm, MaintenanceTaskQuery } from '@/api/interface/als/maintenanceTask'
/**
 * @name 查询维修任务列表
 * @param query 参数
 * @returns 返回列表
 */
export const listMaintenanceTaskApi = (query: MaintenanceTaskQuery) => {
  return http.get<MaintenanceTaskVO[]>('/als/maintenanceTask/list', query, { loading: true })
}

/**
 * @name 查询维修任务详细
 * @param id id
 * @returns returns
 */
export const getMaintenanceTaskApi = (id: string | number) => {
  return http.get<MaintenanceTaskVO>(`/als/maintenanceTask/${id}`)
}

/**
 * @name 新增维修任务
 * @param data data
 * @returns returns
 */
export const addMaintenanceTaskApi = (data: MaintenanceTaskForm) => {
  return http.post<any>('/als/maintenanceTask', data, { loading: false })
}

/**
 * @name 修改维修任务
 * @param data data
 * @returns returns
 */
export const updateMaintenanceTaskApi = (data: MaintenanceTaskForm) => {
  return http.put<any>('/als/maintenanceTask', data, { loading: false })
}

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

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