package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
import com.ruoyi.system.api.domain.RmDeployScriptRemote;
import com.ruoyi.system.api.domain.RmMonitorPolicyRemote;
import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
import com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "remoteRocketMqService", value = ServiceNameConstants.ROCKETMQ_SERVICE, fallbackFactory = RemoteRocketMqFallbackFactory.class)
public interface RemoteRocketMqService {
    /**
     * 发送异步消息
     * @param topic
     * @param tag
     * @param key
     * @param value
     * @param source
     * @return
     */
    @PostMapping("/api/rocketMessage/sendAsyncProducerMessage")
    public R<Map> sendAsyncProducerMessage(@RequestParam("topic") String topic, @RequestParam("tag") String tag, @RequestParam("key") String key, @RequestParam("value") String value, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 查询告警记录
     *
     * @param rmAlarmRecordRemote
     * @param source
     * @return
     */
    @PostMapping("/alarmRecord/getAlarmList")
    public R<List<RmAlarmRecordRemote>> getAlarmList(@RequestBody RmAlarmRecordRemote rmAlarmRecordRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 资源告警处理情况
     * @param source
     * @return
     */
    @GetMapping("/alarmRecord/alarmHandlingStatus")
    public R<Map> alarmHandlingStatus(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取网卡接口列表
     * @param rmNetworkInterfaceRemote
     * @param source
     * @return
     */
    @PostMapping("/networkInterface/getNetworkInterfaceList")
    public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 获取网卡接口列表
     * @param rmNetworkInterfaceRemote
     * @param source
     * @return
     */
    @PostMapping("/networkInterface/bindPublicIp")
    public R<Integer> bindPublicIp(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     * 下发策略
     * @param id
     * @param source
     * @return
     */
    @GetMapping("/monitorPolicy/innerIssueSwitchPolicy")
    public R<String> innerIssueSwitchPolicy(Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     * 查询策略信息
     * @param rmMonitorPolicyRemote
     * @param source
     * @return
     */
    @PostMapping("/monitorPolicy/getPolicyMsgInner")
    public R<List<RmMonitorPolicyRemote>> getPolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    /**
     * 策略添加新设备
     * @param rmMonitorPolicyRemote
     * @param source
     * @return
     */
    @PostMapping("/monitorPolicy/updatePolicyMsgInner")
    public R<Integer> updatePolicyMsgInner(@RequestBody RmMonitorPolicyRemote rmMonitorPolicyRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 下发优先级为0的策略
     * @param clientId
     * @param source
     * @return
     */
    @GetMapping("/monitorPolicy/issueDefaultPolicyByClientId")
    public R<Integer> issueDefaultPolicyByClientId(String clientId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    @PostMapping("policy/addDeployScript")
    R<Integer> addDeployScript(@RequestBody RmDeployScriptRemote addData, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
