import http from '@/api'
import { SafeRuleVO, SafeRuleForm, SafeRuleQuery } from '@/api/interface/als/safeRule'
/**
 * @name 查询保障规则列表
 * @param query 参数
 * @returns 返回列表
 */
export const listSafeRuleApi = (query: SafeRuleQuery) => {
  return http.get<SafeRuleVO[]>('/als/safeRule/list', query, { loading: true })
}

/**
 * @name 查询保障规则详细
 * @param id id
 * @returns returns
 */
export const getSafeRuleApi = (id: string | number) => {
  return http.get<SafeRuleVO>(`/als/safeRule/${id}`)
}

/**
 * @name 新增保障规则
 * @param data data
 * @returns returns
 */
export const addSafeRuleApi = (data: SafeRuleForm) => {
  return http.post<any>('/als/safeRule', data, { loading: false })
}

/**
 * @name 修改保障规则
 * @param data data
 * @returns returns
 */
export const updateSafeRuleApi = (data: SafeRuleForm) => {
  return http.put<any>('/als/safeRule', data, { loading: false })
}

/**
 * @name 删除保障规则
 * @param id id
 * @returns returns
 */
export const delSafeRuleApi = (id: string | number | Array<string | number>) => {
  return http.delete<any>(`/als/safeRule/${id}`)
}

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

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

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