package com.ruoyi.controller;

import com.ruoyi.annotations.UserLoginToken;
import com.ruoyi.controller.req.IsNeedGetOrderDetailReq;
import com.ruoyi.controller.req.IsNeedGetOrderDetailReq2;
import com.ruoyi.controller.req.MessageReadOrDeleteReq;
import com.ruoyi.response.ResponseData;
import com.ruoyi.service.MessageService;
import com.ruoyi.vo.RyController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 消息中心
 * @author liwenlong
 *
 */
@CrossOrigin
@RestController
@RequestMapping("/api/message")
@Api(tags = "消息中心")
public class ApiMessageController extends RyController {


    @Autowired
    private MessageService messageService;


    /**
     * 消息中心
     *
     * @author liwenlong
     *
     */
    @UserLoginToken
    @PostMapping("/messageCenter")
    public ResponseData<Map<String, Object>> messageCenter() {
        return messageService.messageCenter(getUserVo());
    }

    @PostMapping("/isNeedGetMessageCenter")
    @ApiOperation(value = "是否需要重新调用消息中心接口", notes = "是否需要重新调用消息中心接口")
    @UserLoginToken
    public ResponseData<Boolean> isNeedGetMessageCenter(@RequestBody IsNeedGetOrderDetailReq2 req) {
        return messageService.isNeedGetMessageCenter(req,getUserVo());
    }

    @UserLoginToken
    @PostMapping("/messageReadOrDelete")
    @ApiOperation(value = "消息列表_已读，删除消息", notes = "消息列表_已读，删除消息")
    public ResponseData messageReadOrDelete(@RequestBody MessageReadOrDeleteReq req) {
        return messageService.messageReadOrDelete(req, getUserVo());
    }

}
