package com.webchat.controller.admin;

import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.common.helper.SessionHelper;
import com.webchat.config.annotation.ValidateLogin;
import com.webchat.config.annotation.ValidatePermission;
import com.webchat.domain.vo.request.mess.ChatMessageRequestVO;
import com.webchat.domain.vo.response.mess.ChatMessageResponseVO;
import com.webchat.domain.vo.response.mess.UserMessListResponseVO;
import com.webchat.service.ChatMessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 程序员七七
 * @webSite https://www.coderutil.com
 * @Date 2022/12/10 22:29
 * @description
 */
@Api(tags = "【管理后台】对话消息管理")
@RestController
@RequestMapping("/api/chat/mess")
public class AdminChatMessController {
    @Autowired
    private ChatMessService chatMessService;

    @ApiOperation("对话消息列表查询接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "mess", value = "消息内容", dataType = "String"),
            @ApiImplicitParam(name = "pageNo", value = "页码，默认1", dataType = "Integer"),
            @ApiImplicitParam(name = "pageSize", value = "页条数，默认8", dataType = "Integer")
    })
    @ValidatePermission
    @GetMapping("/page")
    public APIPageResponseBean<List<ChatMessageResponseVO>> pageMessage(
            @RequestParam(value = "mess", required = false) String mess,
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
        return chatMessService.pageMessage(mess, pageNo, pageSize);
    }
}
