import request from '@/config/axios'
import { DepartmentListResponse, DepartmentUserParams, DepartmentUserResponse } from './types'

export const getDepartmentApi = () => {
  return request.get<DepartmentListResponse>({ url: '/department/list' })
}

export const getUserByIdApi = (params: DepartmentUserParams) => {
  return request.get<DepartmentUserResponse>({ url: '/department/users', params })
}

export const deleteUserByIdApi = (ids: string[] | number[]) => {
  return request.post({ url: '/department/user/delete', data: { ids } })
}

export const saveUserApi = (data: any) => {
  return request.post({ url: '/department/user/save', data })
}

export const saveDepartmentApi = (data: any) => {
  return request.post({ url: '/department/save', data })
}

export const deleteDepartmentApi = (ids: string[] | number[]) => {
  return request.post({ url: '/job/RepTask/delete', data: { ids } })
}

export const getDepartmentTableApi = (params: any) => {
  return request.post({ url: '/job/spi/job/RepTask/RepTaskQueryPage', params })
}

export const reRunApi = (taskId: string) => {
  return request.post({ url: '/job/RepTask/taskReRun', data: { taskId } })
}
export const downLoadErrorApi = (id: string) => {
  return request.post({ url: '/job/RepTask/downLoadRepTaskErr', data: { id } })
}
