import request from '@/utils/request'

export function list(data) {
    return request({
        url: '/user-boot/role/list',
        method: 'post',
        data: data
    })
}
export function listRoleMenu(data) {
    return request({
        url: '/user-boot/roleFunction/getFunctionsByRoleIndex',
        method: 'post',
        params: data
    })
}
export function updateRoleMenu(data) {
    return request({
        url: '/user-boot/function/assignFunctionByRoleIndexes',
        method: 'post',
        data: data
            // params: roleIndex,functionIndexList
            // data:{
            //   roleIndex,functionIndexList
            // }
    })
}
export function add(data) {
    return request({
        url: '/user-boot/role/add',
        method: 'post',
        data: data
    })
}
export function getByIdroel(roleIndex) {
    return request({
        url: '/user-boot/role/getRoleByRoleIndex?roleIndex=' + roleIndex,
        method: 'get',
        //params: data
    })
}
export function update(data) {
    return request({
        url: '/user-boot/role/update',
        method: 'post',
        data: data
    })
}
export function panduan(data) {
    return request({
        url: '/user-boot/role/selectFunctionComponent',
        method: 'post',
        data: data
    })
}

export function del(data) {
    return request({
        url: '/user-boot/role/delete',
        method: 'post',
        data: data
    })
}
export function get(data) {
    return request({
        url: `/user-boot/role/deleteRoles`,
        method: 'delete',
        data: data
    })
}

export function listRolePermission(data) {
    return request({
        url: '/user-boot/function/getButtonsByFunction',
        method: 'get',
        params: data
    })
}
export function updateRolePermission(roleIndex, functionIndexList) {
    return request({
        url: '/user-boot/roleFunction/assignFunctionByRoleIndexes?roleIndex=' + roleIndex + '&&functionIndexList=' + functionIndexList,
        method: 'put',
        // params: data
    })
}
export function deleteRole(roleIndex) {
    return request({
        url: '/user-boot/role/deleteRoles?roleIndex=' + roleIndex,
        method: 'delete',
        // params: data
    })
}
export function selecRoleDetail(data) {
    return request({
        url: '/user-boot/role/selectRoleDetail',
        method: 'post',
        params: data
    })
}