import { fetch, post, ApiResponse } from './index'

export function createRole(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/role/create', params })
}

export function updateRole(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/role/update', params })
}

export function removeRole(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/role/remove', params })
}

export function queryRoleList(params = {}): Promise<ApiResponse<any[]>> {
  return fetch({ url: '/upms/role/list', params })
}

export function queryRoleMenuTree(params = {}): Promise<ApiResponse<any[]>> {
  return fetch({ url: '/upms/role/menu/tree', params })
}

export function queryRoleMenuTreeSelected(params = {}): Promise<ApiResponse<any[]>> {
  return fetch({ url: '/upms/role/menu/tree/selected', params })
}

export function createRoleAuth(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/role/auth/create', params })
}

export function createRolePermission(params = {}): Promise<ApiResponse<any>> {
  return post({ url: '/upms/role/permission/create', params })
}
