import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/jobslink-api/system/role/roleList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getRoleList = (current, size, params) => {
  return request({
    url: '/api/jobslink-api/system/role/roleList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const grantTree = () => {
  return request({
    url: '/api/jobslink-api/system/menu/grant-tree',
    method: 'get',
  })
}

export const grant = (roleIds, menuIds, dataScopeIds, apiScopeIds) => {
  return request({
    url: '/api/jobslink-api/system/role/grant',
    method: 'post',
    data: {
      roleIds,
      menuIds,
      dataScopeIds,
      apiScopeIds
    }
  })
}

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

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

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


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

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