package com.xindazhou.message.api;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.message.service.PushService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

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

/**
 * 消息推送 API 实现类
 *
 * @author xindazhou
 */
@RestController
@Validated
public class PushApiImpl implements PushApi {

    @Resource
    private PushService pushService;

    @Override
    public CommonResult<Boolean> pushToUser(Long userId, String event, Map<String, Object> data) {
        pushService.pushToUser(userId, event, data);
        return success(true);
    }

}

