package com.hotent.base.feign;

import com.hotent.base.conf.DecryptingFeignConfig;
import com.hotent.base.feign.impl.AuthFeignServiceFactory;
import com.hotent.base.vo.InstanceLimitValidVo;
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;

/**
 * 授权中心 feign客户端访问类
 *
 * @author 欧阳高龙
 * @company 广州宏天软件股份有限公司
 * @since 2022/8/22 10:40
 */
@FeignClient(name="${eip.feignClient.auth:eip-auth}", contextId = "eip-auth", fallbackFactory = AuthFeignServiceFactory.class, configuration= DecryptingFeignConfig.class, primary = false)
public interface AuthFeignService {

	/**
	 * BPM-runtime服务实例启动时调用，授权中心维护服务实例数量
	 * @param instanceLimitValidVo 回调url，授权中心通过回调url验证实例是否在线
	 * @return 是否允许启动，如超过最大实例数据则不允许启动（加密信息，防止伪造授权中心）
	 */
	@RequestMapping(value="/authorize/v1/bpmRuntimeStartUp",method= RequestMethod.POST, produces = { "application/json; charset=utf-8" })
	InstanceLimitValidVo bpmRuntimeStartUp(@RequestBody InstanceLimitValidVo instanceLimitValidVo) throws  Exception;
}
