package com.yuchen.saas.parking.api.feign;

import com.yuchen.saas.parking.api.dto.coupon.*;
import com.yuchen.saas.parking.api.entity.coupon.PmgBatCouponRecord;
import com.yuchen.saas.parking.api.vo.coupon.*;
import io.swagger.annotations.ApiParam;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 蔡文强
 * @Date 2023/5/25 15:56
 * @Description 优惠券模块远程调用
 */
@FeignClient(
        value = AppNameConstant.SAAS_PARKING,
        fallbackFactory = PmgBatCouponFeignClientFallback.class
)
public interface PmgBatCouponFeignClient {

    /**
     * 小程序->优惠卡列表
     */
    @GetMapping("/coupon/card/app/list")
    R<List<PmgBatCouponCardAppVO>> getCouponCardAppList(@ApiParam(name = "companyId", value = "企业ID", required = true) @RequestParam Long companyId);

    /**
     * 小程序->个人优惠卡列表
     */
    @GetMapping("/coupon/card/app/mylist")
    R<List<PmgBatCouponCardAppVO>> getMyCouponCardAppList(@ApiParam(name = "phone", value = "用户手机号", required = true) @RequestParam String phone);

    /**
     * 优惠卡详情
     * @param id 优惠卡ID
     * @return
     */
    @GetMapping("/coupon/card/detail/{id}")
    R<PmgBatCouponCardVO> getCouponCardDetailById(@PathVariable("id") Long id);

    /**
     * 优惠卡绑定访客/解绑访客
     */
    @PostMapping("/coupon/card/bind/visitor")
    R<Boolean> couponCardBindVisitor(@RequestBody @Validated PmgBatCouponCardBindVisitorDTO bindVisitorDTO);

    /**
     *  优惠券详情
     */
    @GetMapping("/coupon/record/detail/{id}")
    R<PmgBatCouponRecordVO> getCouponRecordById(@PathVariable("id") Long id);

    /**
     * 小程序->优惠卡优惠券使用明细
     */
    @GetMapping("/coupon/record/app/couponCard/useDetail/{couponCardId}")
    R<List<PmgBatCouponRecordUseDetailAppVO>> getAppCouponCardUseDetail(@PathVariable("couponCardId") Long couponCardId);

    /**
     * 小程序->优惠卡发放优惠券
     */
    @PostMapping("/coupon/record/distribute/coupon")
    R<PmgBatDistributeCouponResVO> distributeCoupon(@RequestBody PmgBatCouponRecordDTO couponRecordDTO);

    /**
     * 小程序->扫描优惠卡二维码获取优惠券详情
     */
    @GetMapping("/coupon/record/scan/{couponId}")
    R<PmgBatCouponRecordScanVO> getCouponRecordScanInfo(@PathVariable("couponId") Long couponId, @ApiParam(name = "qrCodeId", value = "优惠券发放ID", required = true) @RequestParam Long qrCodeId);

    /**
     * 小程序->扫描优惠卡(优惠活动)二维码领取优惠券
     */
    @PostMapping("/coupon/record/receive")
    R<PmgBatCouponRecord> receiveCoupon(@RequestBody PmgBatCouponReceiveDTO couponReceiveDTO);

    /**
     * 小程序->我的卡券中心->优惠券列表
     */
    @PostMapping ("/coupon/record/app/mylist")
    R<NestPage<PmgBatMyAppCouponRecordVO>> getAppMyCouponRecordPageList(@RequestBody PmgBatMyAppCouponRecordQueryDTO queryDTO);

    /**
     * 小程序->生成二维码
     */
    @PostMapping("/coupon/record/createQrCode")
    R<PmgBatCouponQrCodeVO> createQrCode(@RequestBody PmgBatCouponQrCodeDTO couponQrCodeDTO);

}
