package org.security.ht.feign;

import org.security.common.constant.CommonConstant;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(
	value = CommonConstant.APPLICATION_SECURITY
)
public interface IHtClient {

	String API_PREFIX = "/client";
	String UPDATE_STATE_BY_ID = API_PREFIX + "/update-state-by-id";
	String SEND_ALARM_NOTICE = API_PREFIX + "/send-alarm-notice";
	String SEND_SCC_CHECK_NOTICE = API_PREFIX + "/send-scc-check-notice";
	String AFTER_FLOW_FINISHED = API_PREFIX + "/after-flow-finished";

	/**
	 * 根据id修改状态
	 *
	 * @param serviceBeanName serviceBean名称
	 * @param id 主键
	 * @param state 状态
	 * @return
	 */
	@GetMapping(UPDATE_STATE_BY_ID)
	R updateStateById(@RequestParam("serviceBeanName") String serviceBeanName, @RequestParam("id") String id, @RequestParam("state") String state);

	/**
	 * 根据id修改状态
	 *
	 * @param serviceBeanName serviceBean名称
	 * @param id 主键
	 * @param pass 是否通过
	 * @param variables service需要用到的参数
	 * @return
	 */
	@PostMapping(AFTER_FLOW_FINISHED)
	R afterFlowFinished(@RequestParam("serviceBeanName") String serviceBeanName, @RequestParam("id") String id, @RequestParam(value = "pass", required = false) Boolean pass, @RequestBody Map<String, Object> variables);

	/**
	 * 警情推送
	 *
	 * @param answerAlarmId 接警记录id
	 * @return
	 */
	@GetMapping(SEND_ALARM_NOTICE)
	R sendAlarmNotice(@RequestParam("answerAlarmId") String answerAlarmId);

	/**
	 * 下发整改通知书
	 *
	 * @param sccCheckId 接警记录id
	 * @return
	 */
	@GetMapping(SEND_SCC_CHECK_NOTICE)
	R sendSccCheckNotice(@RequestParam("sccCheckId") String sccCheckId);
}
