/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.authcore.remote;

import com.codvision.authcore.bean.PageData;
import com.codvision.authcore.bean.SysMenuBean;
import com.codvision.authcore.bean.SysUserBean;
import com.codvision.authcore.remote.fallback.RemoteAuthServiceFallback;
import com.codvision.commoncore.common.ResponseEntity;
import com.codvision.commonfeign.config.OpenFeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 认证服务远程调用
 *
 * @author lingee
 * @date 2023/7/18
 */
@FeignClient(name = "remote-auth-sevice", url = "${cvbp.auth.host}", fallback = RemoteAuthServiceFallback.class,
        configuration = OpenFeignConfig.class)
public interface RemoteAuthService {

    /**
     * 获取当前登录用户信息
     *
     * @param token token
     * @return 用户信息
     */
    @PostMapping("/sysUser/getUserInfo")
    ResponseEntity<SysUserBean> getUserInfo(@RequestHeader(value = "Authorization") String token);

    /**
     * 获取权限菜单列表
     *
     * @param page 当前页
     * @param size 页面大小lø
     * @return 菜单列表
     */
    @PostMapping("/findAll")
    ResponseEntity<PageData<SysMenuBean>> getUserMenus(@RequestHeader(value = "Authorization") String token,
                                                       @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                                                       @RequestParam(value = "size", required = false, defaultValue = "1000") int size);
}
