package com.wzj.soopin.order.controller;

import com.wzj.soopin.order.domain.query.GrabRedPacketRequest;
import com.wzj.soopin.order.domain.query.SendRedPacketRequest;
import com.wzj.soopin.order.service.RedPacketService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dromara.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 红包功能控制器
 */
@RestController
@RequestMapping("/api/packet")
@Api(tags = "红包功能接口")
public class RedPacketController {

    @Autowired
    private RedPacketService redPacketService;

    /**
     * 发红包接口
     * @param request 发红包请求参数
     * @return 红包创建结果
     */
    @PostMapping("/send")
    @ApiOperation("发红包")
    public R<Map<String, Object>> sendRedPacket(@RequestBody SendRedPacketRequest request) {
        Map<String, Object> result = redPacketService.sendRedPacket(request);
        return R.ok("红包发送成功", result);
    }

    /**
     * 抢红包接口
     * @return 抢红包结果
     */
    @PostMapping("/grab")
    @ApiOperation("抢红包")
    public R<Map<String, Object>> grabRedPacket(@RequestBody GrabRedPacketRequest request) {
        Map<String, Object> result = redPacketService.grabRedPacket(request);
        return R.ok("红包领取成功", result);
    }

//    /**
//     * 查询红包详情接口
//     * @param packetId 红包ID
//     * @return 红包详情
//     */
//    @GetMapping("/detail/{packetId}")
//    @ApiOperation("查询红包详情")
//    public R<RedPacketDetailVO> getRedPacketDetail(@PathVariable Long packetId) {
//        RedPacketDetailVO detail = redPacketService.getRedPacketDetail(packetId);
//        return R.ok(detail);
//    }
//
//    /**
//     * 查询用户领取的红包记录
//     * @param userId 用户ID
//     * @param pageNum 页码
//     * @param pageSize 每页条数
//     * @return 领取记录列表
//     */

}
