package com.xindazhou.message.api;

import com.xindazhou.framework.common.pojo.CommonResult;
import com.xindazhou.message.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * 消息推送 API
 * 
 * 供其他服务调用，用于推送消息给客户端
 *
 * @author xindazhou
 */
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - 消息推送")
public interface PushApi {

    String PREFIX = ApiConstants.PREFIX + "/push";

    @PostMapping(PREFIX + "/user")
    @Operation(summary = "推送给指定用户")
    CommonResult<Boolean> pushToUser(@RequestParam("userId") Long userId,
                                     @RequestParam("event") String event,
                                     @RequestBody Map<String, Object> data);

}

