package com.zd.system.api.message;

import com.zd.common.core.constant.ServiceNameConstants;
import com.zd.common.core.domain.R;
import com.zd.common.core.template.TemplateResult;
import com.zd.system.api.message.factory.RemoteMessageFallbackFactory;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
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.Date;
import java.util.List;

@FeignClient(contextId = "remoteMessageService", value = ServiceNameConstants.MESSAGE_SERVICE, fallbackFactory = RemoteMessageFallbackFactory.class)
public interface RemoteMessageService {

    @GetMapping("/wx/backlog")
    @ApiOperation(value = "待办事项消息发送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "backlogName",value = "待办事项名称"),
            @ApiImplicitParam(name = "remark",value = "备注")
    })
    R<TemplateResult> backlog(@RequestParam("userId") Long userId,
                              @RequestParam("backlogName") String backlogName,
                              @RequestParam("remark") String remark);

    @GetMapping("/wx/check")
    @ApiOperation(value = "审核消息发送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "checkType",value = "审核类型 1：资格申请 2：用气申请"),
            @ApiImplicitParam(name = "checkStatus",value = "审核状态 1：通过 2：已驳回"),
            @ApiImplicitParam(name = "checkTime",value = "审核时间")
    })
    R<TemplateResult> check(@RequestParam("userId") Long userId,
                            @RequestParam("checkType") Integer checkType,
                            @RequestParam("checkStatus") Integer checkStatus,
                            @RequestParam("checkTime") Date checkTime,
                            @RequestParam("taskId")Long taskId);
    @GetMapping("stu/check")
    @ApiOperation(value = "学生端审核消息发送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "checkType",value = "审核类型 1：资格申请 2：用气申请"),
            @ApiImplicitParam(name = "checkStatus",value = "审核状态 1：通过 2：已驳回"),
            @ApiImplicitParam(name = "checkTime",value = "审核时间"),
            @ApiImplicitParam(name = "taskId",value = "任务主键"),
    })
    R<TemplateResult> stuCheck(@RequestParam("userId") Long userId,
                               @RequestParam("checkType") Integer checkType,
                               @RequestParam("checkStatus") Integer checkStatus,
                               @RequestParam("checkTime") Date checkTime,
                               @RequestParam("taskId")Long taskId);

    @GetMapping("/wx/storage/out")
    @ApiOperation(value = "出库确认通知")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "outType",value = "出库类型"),
            @ApiImplicitParam(name = "outTime",value = "出库时间")
    })
    R<TemplateResult> storageOut(@RequestParam("userId") Long userId,
                                 @RequestParam("outType") String outType,
                                 @RequestParam("outTime") Date outTime);

    @GetMapping("/wx/wait/check")
    @ApiOperation(value = "待审核消息发送")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "checkType",value = "审核类型 1：资格申请 2：用气申请"),
            @ApiImplicitParam(name = "name",value = "申请人"),
            @ApiImplicitParam(name = "applyTime",value = "申请时间")
    })
    R<TemplateResult> waitCheck(@RequestParam("userId") Long userId,
                                @RequestParam("checkType") Integer checkType,
                                @RequestParam("name") String name,
                                @RequestParam("applyTime") Date applyTime);

    @PostMapping("/wx/send/alarm")
    @ApiOperation(value = "气瓶超出范围通知")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userIds",value = "上报接收人"),
            @ApiImplicitParam(name = "address",value = "报警位置")
    })
    R<TemplateResult> sendAlarm(@RequestBody List<Long> userIds, @RequestParam("address") String address);
}
