package com.sqx.modules.activity.controller.app;

import com.sqx.common.query.PageQuery;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.activity.service.ActivityShopService;
import com.sqx.modules.activity.vo.ActivityShopVO;
import com.sqx.modules.activity.vo.ShopActivityGroupVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动店铺
 *
 * @author : codingliang
 * @date : 2024-06-22 9:53
 */
@Api(tags = "活动-app活动商家")
@RestController
@RequestMapping("app/activity-shop")
@RequiredArgsConstructor
public class AppActivityShopController {

    private final ActivityShopService activityShopService;

    @ApiOperation(value = "活动参与的商家列表", response = ActivityShopVO.class)
    @GetMapping("activity-shop-page/{activityId}")
    public Result getActivityShopPage(@PathVariable @ApiParam("活动id") Long activityId, PageQuery queryDTO) {
        PageUtils page = activityShopService.getShopByActivityId(activityId, queryDTO);
        return Result.success().put("data", page);
    }

    @ApiOperation(value = "获取店铺参与的活动分组", response = ShopActivityGroupVO.class)
    @GetMapping("shop-activity-group/{shopId}")
    public Result getShopActivity(@PathVariable @ApiParam("店铺id") Long shopId) {
        ShopActivityGroupVO shopActivityVO = activityShopService.getShopActivityGroup(shopId);
        return Result.success().put("data", shopActivityVO);
    }
}
