package shop.alien.store.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import shop.alien.entity.result.R;
import shop.alien.entity.store.vo.StoreVipLogVo;
import shop.alien.store.service.StoreVipLogService;

/**
 * 商家会员记录 前端控制器
 *
 * @author ssk
 * @since 2025-02-20
 */
@Slf4j
@Api(tags = {"门店vip购买记录表"})
@ApiSort(14)
@CrossOrigin
@RestController
@RequestMapping("/storeVipLog")
@RequiredArgsConstructor
public class StoreVipLogController {

    private final StoreVipLogService storeVipLogService;

    @ApiOperation("web-分页查询vip记录")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "Integer", paramType = "query", required = true),
            @ApiImplicitParam(name = "pageSize", value = "页容", dataType = "Integer", paramType = "query", required = true),
            @ApiImplicitParam(name = "storeName", value = "门店名称", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "orderNo", value = "订单编号", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "vipStatus", value = "vip状态(0:未过期,1:已过期)", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "vipType", value = "vip类型(1:黄金, 2:白金)", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "buyDuration", value = "购买时长(1:包月, 2:包季, 3:包年)", dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "createdDate", value = "开通时间", dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "expirationDate", value = "过期时间", dataType = "String", paramType = "query")
    })
    @GetMapping(value = "/getStoreVipLogPage")
    public R<IPage<StoreVipLogVo>> getStoreVipLogPage(Integer pageNum, Integer pageSize, String storeName, String orderNo, Integer vipStatus, Integer vipType, Integer buyDuration, String createdDate, String expirationDate) {
        return R.data(storeVipLogService.getStoreVipLogPage(pageNum, pageSize, storeName, orderNo, vipStatus, vipType, buyDuration, createdDate, expirationDate));
    }

}
