package com.persagy.dmp.auth.client;

import cn.hutool.extra.spring.SpringUtil;
import com.persagy.dmp.auth.domain.*;
import com.persagy.dmp.common.model.response.CommonResult;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * boss-auth服务门面类
 * @author : lijie
 * Update By 2022/1/10 19:21
 */
@Slf4j
public class BossAuthFacade extends AuthFacade{

    private static BossAuthClient client = SpringUtil.getBean(BossAuthClient.class);

    /**
     * 查询登录账号个人信息（内部系统）
     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.String>
     * @author : lijie
     * Update By 2022/1/11 10:31
     */
    public static CommonResult<BossAuthUser> loginInnerLoginInfo(){
        return handleResultCode(client.loginInnerLoginInfo(),Boolean.TRUE);
    }

    /**
     * 查询登录账号个人信息（saas系统）
     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.String>
     * @author : lijie
     * Update By 2022/1/11 10:34
     */
    public static CommonResult<BossAuthUser> loginOuterLoginInfo(){
        return handleResultCode(client.loginOuterLoginInfo(),Boolean.TRUE);
    }

    /**
     * 查询登录账号菜单权限
     * @param websiteId : 网站id
     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.String>
     * @author : lijie
     * Update By 2022/1/11 10:30
     */
    public static CommonResult<List<BossAuthMenu>> loginMenu(String websiteId){
        return handleResultCode(client.loginMenu(websiteId),Boolean.TRUE);
    }

    /**
     * 查询登录账号数据权限
     * @param websiteId : 网站id
     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.String>
     * @author : lijie
     * Update By 2022/1/11 10:33
     */
    public static CommonResult<List<BossAuthPermission>> loginPermission(String websiteId){
        return handleResultCode(client.loginPermission(websiteId),Boolean.TRUE);
    }

}
