import { stringify } from 'qs';
import { request } from '@umijs/max';

import webpath from '@/utils/webPath';

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


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


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


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


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


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


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



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


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


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

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


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


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


export async function getPageProUserByAuthId(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prouserauth/getPageProUserByAuthId`, {
        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 queryPageForProUserChild(params = {}) {
    return request(`/${webpath.portalwebpath}/web/api/service/prouser/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

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

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