package shop.alien.second.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import shop.alien.second.service.RiskControlService;

@RestController
@RequestMapping("/riskControl")
@RequiredArgsConstructor
public class RiskControlController {
    
    private final RiskControlService riskControlService;
    
    /**
     * 记录风控数据
     *
     * @param userId     用户ID
     * @param ruleType   规则类型 1:洗钱嫌疑 2:账号异常 3:交易欺诈 4:异常发布
     * @param ruleName   规则名称
     * @param businessId 业务ID
     * @param detailInfo 详细信息（JSON格式）
     */
    @PostMapping("/record")
    public void recordRiskControlData(@RequestParam("userId") Integer userId,
                                      @RequestParam("ruleType") Integer ruleType,
                                      @RequestParam("ruleName") String ruleName,
                                      @RequestParam("businessId") String businessId,
                                      @RequestParam("detailInfo") String detailInfo) {
        riskControlService.recordRiskControlData(userId, ruleType, ruleName, businessId, detailInfo);
    }

    /**
     * 发送封禁通知
     */
    @GetMapping("/sendNotice")
    public void sendNotice(Integer userId) {
        riskControlService.sendNotice(userId);
    }

}