package com.diagbot.client;

import com.diagbot.client.hystrix.AuthServiceHystrix;
import com.diagbot.dto.AnalyzeDTO;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.JWT;
import com.diagbot.vo.AnalyzeVO;
import com.diagbot.vo.DataImportVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * @Description: 请求认证授权服务器客户端
 * @author: gaodm
 * @time: 2018/8/2 13:37
 */
@FeignClient(name = "oath-self", url = "${oath.self.address}",fallback = AuthServiceHystrix.class)
public interface AuthServiceClient {

    @PostMapping(value = "/oauth/token")
    JWT getToken(@RequestHeader(value = "Authorization") String authorization, @RequestParam("grant_type") String type, @RequestParam("username") String username, @RequestParam("password") String password);

    @PostMapping(value = "/oauth/token")
    JWT refreshToken(@RequestHeader(value = "Authorization") String authorization, @RequestParam("grant_type") String type, @RequestParam("refresh_token") String refreshToken);

    @PostMapping(value = "/oauth/check_token")
    OAuth2AccessToken checkToken(@RequestHeader(value = "Authorization") String authorization, @RequestParam("token") String token);

    @PostMapping(value = "/qc/behospitalInfo/analyze_rpc")
    RespDTO<AnalyzeDTO> analyze_rpc(@RequestBody AnalyzeVO analyzeVO);

    @PostMapping(value = "/qc/dataimport/import")
    RespDTO<Boolean> dataimport(@RequestBody DataImportVO dataImportVO);
}



