package com.cool.store.controller.webb;

import com.cool.store.dto.recipe.RecipeSpLaunchDTO;
import com.cool.store.request.recipe.RevenueDataRequest;
import com.cool.store.request.recipe.SalesVolumeDayRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ThirdFoodService;
import com.cool.store.vo.recipe.RevenueDataVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 数据看板 前端控制器
 * </p>
 *
 * @author wangff
 * @since 2025/10/30
 */
@RestController
@RequestMapping("/pc/databoard")
@Api(tags = "数据看板")
@Slf4j
@RequiredArgsConstructor
public class DataBoardController {
    private final ThirdFoodService thirdFoodService;

    @ApiOperation("门店营收")
    @PostMapping("/revenueData")
    public ResponseResult<List<RevenueDataVO>> getStoreRevenueData(@RequestBody @Valid RevenueDataRequest request) {
        return ResponseResult.success(thirdFoodService.getRevenueData(request));
    }

    @ApiOperation("查询菜品服务包上新数据")
    @PostMapping("/recipeSpLaunch")
    public ResponseResult<RecipeSpLaunchDTO> getRecipeSpLaunchData(@RequestBody @Valid RevenueDataRequest request) {
        return ResponseResult.success(thirdFoodService.getRecipeServiceLaunch(request));
    }

    @ApiOperation("门店日销量")
    @PostMapping("/storeSalesVolumeDay")
    public ResponseResult<List<RevenueDataVO>> getStoreSalesVolumeDay(@RequestBody @Valid SalesVolumeDayRequest request) {
        return ResponseResult.success(thirdFoodService.storeSalesVolumeDay(request));
    }
}
