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

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

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

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

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

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

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

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