package cn.sikey.websocket.service;

import cn.sikey.websocket.controller.app.message.vo.SaveMessageRecvReqVO;
import cn.sikey.websocket.convert.MessageConvert;
import cn.sikey.websocket.dal.dataobject.MessageRecvDO;
import cn.sikey.websocket.dal.mysql.MessageRecvMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author: nelson
 * @Date: 2025/7/2
 * @Description: 消息发送接收
 */
@Service
@Slf4j
public class MessageRecvServiceImpl implements MessageRecvService {

    @Resource
    private MessageRecvMapper messageRecvMapper;

    /**
     * 保存消息发送接收
     *
     * @param saveMessageRecvReqVO 消息发送接收
     * @return
     */
    @Override
    public void saveMessageRecv(SaveMessageRecvReqVO saveMessageRecvReqVO) {
        MessageRecvDO messageRecvDO = MessageConvert.INSTANCE.convertMessageRecvDO(saveMessageRecvReqVO);
        messageRecvMapper.saveMessageRecv(messageRecvDO);
    }

    /**
     * 更新状态
     *
     * @param status 状态
     * @param ackId  ackId
     * @return
     */
    @Override
    public void updateStatusById(Integer status, Long ackId) {
        messageRecvMapper.updateStatusById(status, ackId);
    }
}
