package com.sqx.modules.gameChat.controller.app;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.datacentre.entity.SysUserShop;
import com.sqx.modules.gameChat.service.ChatContentTcwmService;
import com.sqx.modules.sys.controller.AbstractController;
import com.sqx.modules.sys.dao.SysUserDao;
import com.sqx.modules.sys.entity.SysUserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(value="商户端-订单聊天室",tags={"商户端-订房聊天室"})
@RequestMapping(value = "/shop/ordersChat")
public class AdminOrderChatTcwmController extends AbstractController {

    @Autowired
    private ChatContentTcwmService chatContentTcwmService;
    @Autowired
    private SysUserDao sysUserDao;

    @GetMapping("/selectOrdersChatPageShop")
    @ApiOperation("商户获取聊天室列表")
    public Result selectOrdersChatPageUser(Integer page, Integer limit, Long shopId,Long userId,Long riderId){

        return chatContentTcwmService.selectOrdersChatPage(page, limit, userId, riderId, shopId);
    }

    @PostMapping("/deleteOrdersChat")
    @ApiOperation("删除聊天记录")
    public Result deleteOrdersChat(Long chatContentId){
        chatContentTcwmService.removeById(chatContentId);
        return Result.success();
    }

    @GetMapping("/selectOrdersChatList")
    @ApiOperation("获取所有聊天室列表")
    public Result selectOrdersChatList(Integer page, Integer limit, String userName){
        return chatContentTcwmService.selectOrdersChatList(page, limit, userName);
    }

    @GetMapping("/selectGameChatList")
    @ApiOperation("获取所有聊天记录")
    public Result selectGameChatList(Integer page,Integer limit, String userName,String content,Long ordersId){
        return chatContentTcwmService.selectGameChatList(page, limit, userName, content,ordersId);
    }

    @GetMapping("/selectGameChatDetails")
    @ApiOperation("商户获取聊天内容")
    public Result selectGameChatDetail(Integer page,Integer limit,Long ordersId){

        return chatContentTcwmService.selectGameChatDetails(page, limit, ordersId, 3);
    }

    @ApiOperation("商户获取聊天室未读消息总数")
    @GetMapping(value = "selectShopAllUnreadCount")
    public Result selectShopAllUnreadCount(Long shopId){

        return chatContentTcwmService.selectAllUnreadCount(null, null, shopId);
    }

    @ApiOperation("清空聊天室未读消息总数")
    @GetMapping(value = "updateShopAllUnreadCount")
    public Result updateShopAllUnreadCount(Long shopId){

        return chatContentTcwmService.updateShopAllUnreadCount(null, null, shopId);
    }

    @ApiOperation("商户获取聊天室未读消息数")
    @GetMapping(value = "/selectShopUnreadCount")
    public Result selectShopUnreadCount(Long ordersId){

        return chatContentTcwmService.selectUnreadMessage(ordersId, 3);
    }

}
