import { HcApi } from '../../request/index'

export default {
    async page(form) {
        return HcApi({
            url: '/api/blade-user/page',
            method: 'get',
            params: form,
        })
    },
    //详情
    async detail(id) {
        return HcApi({
            url: '/api/blade-user/detail',
            method: 'get',
            params: { id },
        })
    },
    async add(form) {
        return HcApi({
            url: '/api/blade-user/submit2',
            method: 'post',
            data: form,
        })
    },
    async up(form) {
        return HcApi({
            url: '/api/blade-user/update2',
            method: 'post',
            data: form,
        })
    },
    async del(ids) {
        return HcApi({
            url: '/api/blade-user/remove',
            method: 'post',
            params: { ids },
        })
    },
    //userId, userType, userExt
    async updatePlatform(form) {
        return HcApi({
            url: '/api/blade-user/update-platform',
            method: 'post',
            params: form,
        })
    },
    async getUserPlatform(id) {
        return HcApi({
            url: '/api/blade-user/platform-detail',
            method: 'get',
            params: { id },
        })
    },
    async getUserInfo() {
        return HcApi({
            url: '/api/blade-user/info',
            method: 'get',
            params: {},
        })
    },
    async resetPassword(ids) {
        return HcApi({
            url: '/api/blade-user/reset-password',
            method: 'post',
            params: { userIds: ids },
        })
    },
    //oldPassword, newPassword, newPassword1, plaintextPassword
    async updatePassword(form) {
        return HcApi({
            url: '/api/blade-user/update-password',
            method: 'post',
            params: form,
        })
    },
    async updateInfo(form) {
        return HcApi({
            url: '/api/blade-user/update-info',
            method: 'post',
            data: form,
        })
    },
    //userIds, roleIds
    async grant(form) {
        return HcApi({
            url: '/api/blade-user/grant',
            method: 'post',
            params: form,
        })
    },
    async unlock(ids) {
        return HcApi({
            url: '/api/blade-user/unlock',
            method: 'post',
            params: { userIds: ids },
        })
    },
    async lock(ids) {
        return HcApi({
            url: '/api/blade-user/lock',
            method: 'post',
            params: { userIds: ids },
        })
    },
    async getUserList(form) {
        return HcApi({
            url: '/api/blade-user/user-list',
            method: 'get',
            params: form,
        })
    },
    async getProjectContractList(userId) {
        return HcApi({
            url: '/api/blade-manager/projectInfo/get-project-contract-list',
            method: 'get',
            params: { userId },
        })
    },
    async saveUserInfoByProjectTow(form) {
        return HcApi({
            url: '/api/blade-manager/contractInfo/save-userInfo-by-project-tow',
            method: 'post',
            data: form,
        })
    },
    async removeUsersByIds(ids) {
        return HcApi({
            url: '/api/blade-manager/contractInfo/remove-users-by-ids',
            method: 'post',
            params: { ids },
        })
    },
    async removeUserProjectInfoAndRoleById(id) {
        return HcApi({
            url: '/api/blade-manager/contractInfo/remove-userProjectInfo-role-byId',
            method: 'post',
            params: { id },
        })
    },
}
