
package com.tmerclub.cloud.coupon.controller.platform;


import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.coupon.dto.CouponUserDTO;
import com.tmerclub.cloud.coupon.service.CouponUserService;
import com.tmerclub.cloud.coupon.vo.CouponUserVO;
import com.tmerclub.cloud.coupon.vo.mongo.MongoCouponUserVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 优惠券
 * @author cl
 */
@RestController("platformCouponController")
@RequestMapping("/p/coupon")
@Tag(name = "platform-优惠券")
public class CouponController {

    @Autowired
    private CouponUserService couponUserService;

    @GetMapping("/platformCouponUserPage")
    @Operation(summary = "获取某个用户的优惠券明细", description = "获取某个用户的优惠券明细")
    public ServerResponseEntity<PageVO<MongoCouponUserVO>> platformCouponUserPage(@Valid PageDTO pageDTO, CouponUserDTO couponUserDTO) {
        PageVO<MongoCouponUserVO> couponPage = couponUserService.getPageByUserId(pageDTO, couponUserDTO);
        return ServerResponseEntity.success(couponPage);
    }


}
