package com.xindazhou.message.api;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.message.api.dto.send.MessageSendReqDTO;
import com.xindazhou.message.service.MessageSendService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import jakarta.validation.Valid;

import static com.xindazhou.framework.common.pojo.CommonResult.success;

/**
 * 消息发送 API 实现类
 *
 * @author xindazhou
 */
@RestController
@Validated
public class MessageSendApiImpl implements MessageSendApi {

    @Resource
    private MessageSendService messageSendService;

    @Override
    public CommonResult<Long> sendMessage(@Valid MessageSendReqDTO reqDTO) {
        // TODO: 实现消息发送逻辑
        Long messageId = messageSendService.sendMessage(reqDTO);
        return success(messageId);
    }

}

