import { stringify } from 'qs'
import { request } from '@umijs/max'
import webpath from '@/utils/webPath'

export async function deleteByPrimaryKeyForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/delete?${stringify(params)}`)
}

export async function selectByPrimaryKeyForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/get?${stringify(params)}`)
}

export async function insertForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert'
        }
    })
}

export async function updateForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update'
        }
    })
}

export async function deleteByMapForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete'
        }
    })
}

export async function updateByMapForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update'
        }
    })
}

export async function getOneForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function getAllForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function queryPageForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function countForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function insertBatchForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert'
        }
    })
}

export async function deleteBatchForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete'
        }
    })
}

export async function updateBatchForProResAuth(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update'
        }
    })
}

export async function getProResourceTreeByLevelCode(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresourceaction/getProResourceTreeByLevelCode`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function getAllProResourceTreeByAuthID(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/getAllProResourceTreeByAuthID`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function getPageAuthByProResourceTreeId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/getPageAuthByProResourceTreeId`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function queryPageForProAuthority(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proauthority/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}

export async function insertForProRes(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresourceaction/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert'
        }
    })
}

export async function updateForProRes(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresourceaction/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update'
        }
    })
}

export async function deleteByPrimaryKeyForProRes(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresourceaction/delete?${stringify(params)}`)
}

export async function updateChangeTargetNodeWithSourceNodeForProResource(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/proresauth/updateChangeTargetNodeWithSourceNodeForProResource`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update'
        }
    })
}

export async function getAllForProSystem(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prosystem/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch'
        }
    })
}
