package com.ruoyi.message.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.annotations.UserLoginToken;
import com.ruoyi.common.page.PageResult;
import com.ruoyi.controller.req.MessageReadOrDeleteReq;
import com.ruoyi.message.controller.resp.InteractionMessagePageResp;
import com.ruoyi.message.frequency.interactionmessagerecord.service.InteractionMessageRecordService;
import com.ruoyi.response.ResponseData;
import com.ruoyi.vo.PageBasic;
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.*;


/**
 * 互动消息
 * @author liwenlong
 *
 */
@CrossOrigin
@RestController
@RequestMapping("/api/message")
@Api(tags = "互动消息")
public class ApiInteractionMessageController extends RyController {

    @Autowired
    private InteractionMessageRecordService interactionMessageRecordService;

    @UserLoginToken
    @PostMapping("/interactionMessagePage")
    @ApiOperation(value = "互动消息列表", notes = "互动消息列表")
    public ResponseData<PageResult<Page<InteractionMessagePageResp>>> interactionMessagePage(@RequestBody PageBasic req) {
        return interactionMessageRecordService.interactionMessagePage(req,getUserVo());
    }

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

}
