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

export default {
    //登录
    Login(parms: UserTypes.LoginParams) {
        return request('/api/authorize/login', {
            method: 'POST',
            data: {
                ...parms
            }
        });
    },

    //新增人员
    CreateUser(params: UserTypes.PersonnelType) {
        return request('/api/authorize/addemployee', {
            method: 'POST',
            data: {
                ...params,
            },
        });
    },

    //修改人员信息
    ModifyUser(params: UserTypes.PersonnelType) {
        return request('/api/authorize/editemployee', {
            method: 'POST',
            data: {
                ...params,
            },
        });
    },


    //根据用户ID查询用户信息
    GetUserById(id: string) {
        return request(`/api/base/user/getuserbyid?id=${id}`, {
            method: 'GET',
        });
    },

    //人员分页查询
    GetUserPagedList(params: UserTypes.UserPageParams) {
        return request('/api/authorize/queryemployee', {
            method: 'POST',
            data: {
                ...params,
            },
        });
    },

    /**
     * 获取用户已授权菜单
     */
    GetUserAuthInfo() {
        return request('/api/base/authorize/getuserinfo', {
            method: 'POST',
        });
    },

    GetUserInfo() {
        return request('/api/authorize/getuserinfo', {
            method: 'GET',
        });
    },
    /**
     * 删除用户
     * @param params 
     */
    RemoveUser(employeeId:string){
        return request(`/api/authorize/removeemployee?employeeId=${employeeId}`, {
            method: 'GET'
        });
    },
    /**
     * 绑定账户
     * @param params 
     */
    BindAccount(params: Account.TBAccountDTO) {
        return request('/api/authorize/addaccountbyuser', {
            method: 'POST',
            data: {
                ...params,
            },
        });
    },
    /**
     * 重置账户
     * @param params 
     * @returns 
     */
    RestoreAccount(params: string) {
        return request(`/api/authorize/restoreaccountbyuser?input=${params}`, {
            method: 'GET',
        });
    },
    /**
     * 编辑密码
     * @param params 
     * @returns 
     */
    EditPwd(params: Account.TBAccountPwdDTO) {
        return request(`/api/authorize/editaccountpwd`, {
            method: 'POST',
            data: {
                ...params,
            },
        });
    }
}