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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

export async function getPageAuthByMenuTreeId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenuauth/getPageAuthByMenuTreeId`, {
        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 insertForProMenu(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenu/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert'
        }
    })
}

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

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

export async function updateChangeTargetNodeWithSourceNodeForProMenu(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/promenuauth/updateChangeTargetNodeWithSourceNodeForProMenu`, {
        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'
        }
    })
}
