import { requestData } from '@/utils/request'

export type UserGroupVO = {
  id: number
  name: string
  description: string
  userIds: number[]
  status: number
  remark: string
  createTime: string
}

// 创建用户组
export const createUserGroup = async (data: UserGroupVO) => {
  return await requestData({ url: '/bpm/user-group/create', method: 'POST', data })
}

// 更新用户组
export const updateUserGroup = async (data: UserGroupVO) => {
  return await requestData({ url: '/bpm/user-group/update', method: 'PUT', data })
}

// 删除用户组
export const deleteUserGroup = async (id: number) => {
  return await requestData({ url: '/bpm/user-group/delete?id=' + id, method: 'DELETE' })
}

// 获得用户组
export const getUserGroup = async (id: number) => {
  return await requestData({ url: '/bpm/user-group/get?id=' + id, method: 'GET' })
}

// 获得用户组分页
export const getUserGroupPage = async (params) => {
  return await requestData({ url: '/bpm/user-group/page', method: 'GET', params })
}

// 获取用户组精简信息列表
export const getUserGroupSimpleList = async (): Promise<UserGroupVO[]> => {
  return await requestData({ url: '/bpm/user-group/simple-list', method: 'GET' })
}
