import apiRequest from '@/network/http/apiRequest'

/**
 * 获取角色菜单
 * @returns
 * @param clientId
 * @param roleId
 */
export function getRolePermitByList(clientId: number, roleId: number) {
  return apiRequest({
    url: '/sys/role/permit/' + `${clientId}/${roleId}`,
    method: 'GET',
  })
}

/**
 * 获取角色菜单
 * @returns
 * @param clientId
 * @param roleId
 * @param permitId
 */
export function getRolePermitById(clientId: number, roleId: number, permitId: number) {
  return apiRequest({
    url: '/sys/role/permit/' + `${clientId}/${roleId}/${permitId}`,
    method: 'GET',
  })
}

/**
 * 添加角色权限
 * @param data
 * @returns
 */
export function createRolePermit(data: any) {
  return apiRequest({
    url: '/sys/role/permit/add',
    method: 'POST',
    data,
  })
}

/**
 * 更新角色权限
 * @param data
 * @returns
 */
export function updateRolePermit(data: any) {
  return apiRequest({
    url: '/sys/role/permit/update',
    method: 'PUT',
    data,
  })
}

/**
 * 删除角色权限
 * @returns
 * @param clientId
 * @param roleId
 * @param permitId
 */
export function deleteRolePermitById(clientId: number, roleId: number, permitId: number) {
  return apiRequest({
    url: '/sys/role/permit/' + `${clientId}/${roleId}/${permitId}`,
    method: 'DELETE',
  })
}
