package com.yc.ship.module.marketing.controller.admin.couponAuditRecord;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.module.marketing.controller.admin.couponAuditRecord.vo.CouponAuditRecordSaveReqVo;
import com.yc.ship.module.marketing.service.couponAuditRecord.CouponAuditRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.yc.ship.framework.common.pojo.CommonResult.success;


@Tag(name = "管理后台 - 优惠券审核记录")
@RestController
@RequestMapping("/marketing/couponAuditRecord")
@Validated
public class CouponAuditRecordController {
    @Resource
    private CouponAuditRecordService couponAuditRecordService;
    @PostMapping("/create")
    @Operation(summary = "创建优惠券")
    @PreAuthorize("@ss.hasPermission('marketing:couponAuditRecord:create')")
    public CommonResult<Long> createCoupon(@Valid @RequestBody CouponAuditRecordSaveReqVo createReqVO) {
        return success(couponAuditRecordService.createCouponAuditRecord(createReqVO));
    }
}
