package com.docus.server.message.controller;

import com.docus.server.message.dto.Message;
import com.docus.server.message.service.UnifyMessageService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息接收控制
 *
 * @author wyb
 */
@Api("消息推送")
@RestController
@Slf4j
@RequestMapping("/message/push")
public class MessagePushController {
    private UnifyMessageService unifyMessageService;

    @Autowired
    public void setUnifyMessageService(UnifyMessageService unifyMessageService) {
        this.unifyMessageService = unifyMessageService;
    }

    @PostMapping("/do")
    public String pushInformation(@RequestBody Message message) {
        return unifyMessageService.pushInformation(message.getMethod(), message.getMessage());
    }
}
