package com.dxhy.auth.client.feign;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.dxhy.common.msg.ObjectRestResponse;
import com.dxhy.common.vo.UserInfo;

/**
 * 
 * @author jiaohongyang
 * @date 2019年3月26日 下午5:51:37
 *
 */
@FeignClient("${auth.serviceId:dxhy-admin}")
public interface ServiceAuthFeign {
    /**
     * 鉴权信息
     * 
     * @param serviceId
     *            鉴权id
     * @param secret
     *            鉴权值
     * @return 返回
     */
    @RequestMapping(value = "/client/myClient")
    ObjectRestResponse<List<String>> getAllowedClient(@RequestParam("serviceId") String serviceId,
        @RequestParam("secret") String secret);

    /**
     * 客户端token
     * 
     * @param clientId
     *            客户端id
     * @param secret
     *            值
     * @return 返回
     */
    @RequestMapping(value = "/client/token", method = RequestMethod.POST)
    ObjectRestResponse<?> getAccessToken(@RequestParam("clientId") String clientId,
        @RequestParam("secret") String secret);

    /**
     * key
     * 
     * @param clientId
     *            id
     * @param secret
     *            值
     * @return 返回
     */
    @RequestMapping(value = "/client/servicePubKey", method = RequestMethod.POST)
    ObjectRestResponse<byte[]> getServicePublicKey(@RequestParam("clientId") String clientId,
        @RequestParam("secret") String secret);

    /**
     * key
     * 
     * @param clientId
     *            id
     * @param secret
     *            值
     * @return 返回
     */
    @RequestMapping(value = "/client/userPubKey", method = RequestMethod.POST)
    ObjectRestResponse<byte[]> getUserPublicKey(@RequestParam("clientId") String clientId,
        @RequestParam("secret") String secret);

    /**
     * 获取用户信息
     * 
     * @param userName
     *            用户名
     * @return 返回
     */
    @RequestMapping(value = "/api/user/listInfo", method = RequestMethod.POST)
    UserInfo listUserInfo(@RequestBody String userName);

    /**
     * 定时获取菜单信息
     */
    @RequestMapping(value = "/api/sso/saveMenu", method = RequestMethod.POST)
    void saveMenu();
}
