import { HcApi } from '../../request/index'

export const getList = ( params) => {
  return HcApi({
    url: '/api/blade-system/role/list',
    method: 'get',
    params,
  })
}
export const grantTree = () => {
  return HcApi({
    url: '/api/blade-system/menu/grant-tree',
    method: 'get',
  })
}

export const grant = (data) => {
  return HcApi({
    url: '/api/blade-system/role/grant',
    method: 'post',
    data,
    
  })
}

export const remove = ids => {
  return HcApi({
    url: '/api/blade-system/role/remove',
    method: 'post',
    params: {
      ids,
    },
  })
}

export const add = row => {
  return HcApi({
    url: '/api/blade-system/role/submit',
    method: 'post',
    data: row,
  })
}

export const update = row => {
  return HcApi({
    url: '/blade-system/role/submit',
    method: 'post',
    data: row,
  })
}

export const getRole = roleIds => {
  return HcApi({
    url: '/api/blade-system/menu/role-tree-keys',
    method: 'get',
    params: {
      roleIds,
    },
  })
}

export const getRoleTree = (tenantId, systemType) => {
  return HcApi({
    url: '/api/blade-system/role/tree',
    method: 'get',
    params: {
      tenantId,
      systemType,
    },
  })
}

export const getRoleTreeById = roleId => {
  return HcApi({
    url: '/api/blade-system/role/tree-by-id',
    method: 'get',
    params: {
      roleId,
    },
  })
}
