import http from '@/api'

/**
 * @name 查询角色信息列表
 * @param query 参数
 * @returns 返回列表
 */
export const listRoleApi = (query: any) => {
  return http.get<any>('/system/role/list', query, { loading: true })
}

/**
 * @name 查询角色信息详细
 * @param roleId roleId
 * @returns returns
 */
export const getRoleApi = (roleId: any) => {
  return http.get<any>(`/system/role/${roleId}`)
}

/**
 * @name 新增角色信息
 * @param data data
 * @returns returns
 */
export const addRoleApi = (data: any) => {
  return http.post<any>('/system/role', data, { loading: false })
}

/**
 * @name 修改角色信息
 * @param data data
 * @returns returns
 */
export const updateRoleApi = (data: any) => {
  return http.put<any>('/system/role', data, { loading: false })
}

/**
 * @name 删除角色信息
 * @param roleId roleId
 * @returns returns
 */
export const delRoleApi = ({ roleId }: { roleId: any }) => {
  return http.delete<any>(`/system/role/${roleId}`)
}

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

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

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