package com.ruoyi.cai.controller.app;

import com.ruoyi.cai.dto.app.query.GiveGiftRes;
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
import com.ruoyi.cai.service.GuardTotalService;
import com.ruoyi.cai.service.UserGiftService;
import com.ruoyi.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/consume")
@Tag(name = "消费相关的接口")
public class ConsumeController {

    @Autowired
    private GuardTotalService guardTotalService;
    @Autowired
    private UserGiftService userGiftService;

    @PostMapping("/give/guard")
    @Operation(summary = "赠送主播守护")
    public R<Boolean> giveGuard(@RequestBody GiveGuardReq query){
        boolean res = guardTotalService.giveGuard(query);
        return R.ok(res);
    }

    @PostMapping("/give/gift")
    @Operation(summary = "赠送主播礼物")
    public R<Boolean> giveGift(@RequestBody GiveGiftRes query){
        boolean res = userGiftService.giveGift(query);
        return R.ok(res);
    }
}
