import {
  get,
  post,
} from '@/common/utils/http-util.ts'

export default {
  paging(data: RoleTypes.SearchRoleParam) {
    return get<G.PageResult<RoleTypes.SearchRoleResult>>('/role/paging', data)
  },
  detail(id: string) {
    return get<RoleTypes.SearchRoleResult>('/role/detail', {id})
  },
  add(data: RoleTypes.AddRoleParam) {
    return post('/role/add', data)
  },
  modify(data: RoleTypes.ModifyRoleParam) {
    return post('/role/modify', data)
  },
  del(ids: string[]) {
    return post('/role/del', ids)
  },
  listUserRole(userId: string) {
    return get<RoleTypes.SearchRoleResult[]>('/role/list_user_role', {userId})
  },
  list(data?: RoleTypes.SearchRoleParam) {
    return get<RoleTypes.SearchRoleResult[]>('/role/list', data)
  },
  bindRes(data: RoleTypes.BindResParam) {
    return post('/role/bind_res', data)
  },
}
