import http from '@/api'
import { PostForm, PostQuery, PostVO } from '@/api/interface/system/post'

/**
 * @name 查询岗位信息列表
 * @param query 参数
 * @returns 返回列表
 */
export const listPostApi = (query: PostQuery) => {
  return http.get<PostVO[]>('/system/post/list', query, { loading: false })
}

/**
 * @name 查询岗位信息详细
 * @param postId postId
 * @returns returns
 */
export const getPostApi = (postId: string | number) => {
  return http.get<any>(`/system/post/${postId}`)
}

/**
 * @name 新增岗位信息
 * @param data data
 * @returns returns
 */
export const addPostApi = (data: PostForm) => {
  return http.post<any>('/system/post', data, { loading: false })
}

/**
 * @name 修改岗位信息
 * @param data data
 * @returns returns
 */
export const updatePostApi = (data: PostForm) => {
  return http.put<any>('/system/post', data, { loading: false })
}

/**
 * @name 删除岗位信息
 * @param postId postId
 * @returns returns
 */
export const delPostApi = (postId: string | number | (string | number)[]) => {
  return http.delete<any>(`/system/post/${postId}`)
}

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

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

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