import request from '@/config/axios'

export interface PositionVO {
  id?: number
  name: string
  sort: number
  status: number
  remark: string
  createTime?: Date
}

// 查询职位列表
export const getPositionPage = async (params: PageParam) => {
  return await request.get({ url: '/system/position/page', params })
}

// 获取职位精简信息列表
export const getSimplePositionList = async (): Promise<PositionVO[]> => {
  return await request.get({ url: '/system/position/simple-list' })
}

// 查询职位详情
export const getPosition = async (id: number) => {
  return await request.get({ url: '/system/position/get?id=' + id })
}

// 新增职位
export const createPosition = async (data: PositionVO) => {
  return await request.post({ url: '/system/position/create', data })
}

// 修改职位
export const updatePosition = async (data: PositionVO) => {
  return await request.put({ url: '/system/position/update', data })
}

// 删除职位
export const deletePosition = async (id: number) => {
  return await request.delete({ url: '/system/position/delete?id=' + id })
}

// 导出职位
export const exportPosition = async (params) => {
  return await request.download({ url: '/system/position/export', params })
}
