import http from '@/utils/http'

export function getRolePage(query) {
  return http.post('/role/page', query)
}

export function addRole(role) {
  return http.post(`/role/add`, role)
}

export function editRole(role) {
  return http.put(`/role/edit`, role)
}

export function deleteRole({ roleId }) {
  return http.delete(`/role/${roleId}`)
}

export function getRolePermission(roleId) {
  return http.get(`/role/perms/${roleId}`)
}

export function assignRolePermission(params) {
  return http.post(`/role/assign-perms`, params)
}

export function searchRole({ pageNum }) {
  return http.get(`/role/all/${pageNum}`)
}

export function getRole(roleId) {
  return http.get(`/role/${roleId}`)
}

export function getAllRole() {
  return http.get(`/role/all`)
}
