package ink.wgink.module.instantmessage.controller.resources;

import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
import ink.wgink.module.instantmessage.service.IMessageService;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import io.swagger.annotations.*;
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;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: MessageController
 * @Description: 消息
 * @Author: wanggeng
 * @Date: 2021/1/14 3:25 下午
 * @Version: 1.0
 */
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "消息接口")
@RestController
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/websocket/message")
public class WebSocketMessageResourceController extends DefaultBaseController {

    @Autowired
    private IMessageService messageService;

    @ApiOperation(value = "通知消息", notes = "通知消息接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", required = true),
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @PostMapping("notice")
    @CheckRequestBodyAnnotation
    public SuccessResult notice(@RequestBody NoticeSendVO noticeSendVO) throws Exception {
        messageService.notice(noticeSendVO);
        return new SuccessResult();
    }

}
