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

import com.yuchen.saas.parking.api.entity.VehicleMonthlyCardBillData;
import com.yuchen.saas.parking.api.param.AuditMonthlyCardParam;
import com.yuchen.saas.parking.api.param.ReplacePlateNoCancelParam;
import com.yuchen.saas.parking.api.param.ReplacePlateNoRecordAddParam;
import com.yuchen.saas.parking.api.vo.*;
import io.swagger.annotations.ApiOperation;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @ClassName VisitorClient
 * @Description 访客 feign 接口
 * @Author 张逸飞
 * @Date 2022/6/16 15:50
 */
@FeignClient(
        value = AppNameConstant.SAAS_PARKING,
        fallbackFactory = VehicleMonthlyCardDataClientFallback.class
)
public interface VehicleMonthlyCardDataClient {

    /**
     * 获取车辆申请包期分页数据
     * @param payUserId 移动端用户唯一ID
     * @param payUserId 移动端用户登陆的手机号
     * @param current 当前页码
     * @param size 每页数量
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/getAuditPage")
    R getAuditPage(@RequestParam String payUserId, @RequestParam String personPhone, @RequestParam Integer current,
                   @RequestParam Integer size);

    /**
     * 用户申请月卡
     * @param cardDataVo 用户申请月卡相关数据
     * @return
     */
    @PostMapping("/parking/vehicle/monthly/card/applyMonthlyCard")
    R applyMonthlyCard(@RequestBody VehicleMonthlyCardDataVo cardDataVo);

    /**
     * 用户修改月卡
     * @param cardDataVo 用户修改月卡相关数据
     * @return
     */
    @PostMapping("/parking/vehicle/monthly/card/updateMonthlyCard")
    R updateMonthlyCard(@RequestBody VehicleMonthlyCardDataVo cardDataVo);

    /**
     * 创建月卡支付
     * @param payUserId 移动端用户唯一ID
     * @param id 月卡ID
     * @param number 月数量
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/createMonthlyCardPay")
    R<VehicleMonthlyCardBillData> createMonthlyCardPay(@RequestParam String payUserId, @RequestParam Long id,
                                                       @RequestParam Integer number);

    /**
     * 根据ID查询包期账单详细信息
     * @param payUserId 移动端用户唯一ID
     * @param id 包期账单表
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/getMonthlyCardBill")
    R<VehicleMonthlyCardBillDataVo> getMonthlyCardBill(@RequestParam String payUserId, @RequestParam Long id);

    /**
     * 月卡支付完成回调
     * @param id 月卡支付ID
     * @return
     */
    @PostMapping("/parking/vehicle/monthly/card/monthlyCardPaySuccess")
    R monthlyCardPaySuccess(@RequestBody Long id);

    /**
     * 用户删除月卡
     * @param id 月卡ID
     * @return
     */
    @PostMapping("/parking/vehicle/monthly/card/delMonthlyCard")
    R delMonthlyCard(@RequestBody Long id);

    @PostMapping("/parking/vehicle/monthly/card/applyFree")
    R applyFree(@RequestBody VehicleMonthlyCardDataVo cardDataVo);

    /**
     * 申请月卡更换车牌
     *
     * @param replacePlateNoRecord 月卡更换车牌数据
     * @return
     */
    @PostMapping("/parking/plateNo/replace/applyReplace")
    R applyReplace(@RequestBody ReplacePlateNoRecordAddParam replacePlateNoRecord);

    @GetMapping("/parking/plateNo/replace/getByMonthlyId")
    R<ReplacePlateNoRecordAppVo>  getByMonthlyId(@RequestParam Long id);

    @GetMapping("/parking/plateNo/replace/getByStaggeredId")
    R<ReplacePlateNoRecordAppVo>  getByStaggeredId(@RequestParam Long id);

    @PostMapping("/parking/plateNo/replace/appCancelReplace")
    R  appCancelReplace(@RequestBody ReplacePlateNoCancelParam param);


    /**
     * 根据园区企业统计月卡数量
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/countByParkCompany")
    @ApiOperation(value = "根据园区企业统计月卡数量", notes = "根据园区企业统计月卡数量")
    R countByParkCompany(@RequestParam(required = false) Long parkId, @RequestParam(required = false) Long companyId);



    /**
     * 获取退款信息
     * @param id 月卡ID
     * @param refundTime 退款时间戳
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/getRefundInfo")
    @ApiOperation(value = "获取退款信息", notes = "获取退款信息")
    R getRefundInfo(@RequestParam Long id, @RequestParam Long refundTime);

    /**
     * 获取退款信息
     * @param billId 月卡账单ID
     * @param refundTime 退款时间戳
     * @return
     */
    @GetMapping("/parking/vehicle/monthly/card/getRefundMoney")
    @ApiOperation(value = "获取退款信息", notes = "获取退款信息")
    R<Long> getRefundMoney(@RequestParam Long billId, @RequestParam Long refundTime);

    /**
     * 取消申请月卡
     * @param auditId
     * @return
     */
    @PutMapping("/parking/vehicle/monthly/card/cancel/{auditId}")
    @ApiOperation(value = "取消申请月卡", notes = "取消申请月卡")
    R cancelCard(@PathVariable Long auditId);

    /**
     * 退卡
     * @param refundCardVo 退卡信息
     * @return
     */
    @PostMapping("/parking/vehicle/monthly/card/refundCard")
    @ApiOperation(value = "退卡", notes = "退卡")
    R refundCard(@RequestBody RefundCardVo refundCardVo);


    // ------------------------------    小程序管理端    ------------------------------
    /**
     * 审核回显详情
     *
     * @param id id
     * @return
     * @tag pauly-lyz
     */
    @GetMapping("/parking/vehicle/monthly/card/getAuditDetail")
    R<VehicleMonthlyCardDetailVo>  getAuditDetail(@RequestParam(required = true) Long id);
    /**
     * 审核月卡申请
     *
     * @param param 审核结果
     * @return
     * @tag pauly-lyz
     */
    @PostMapping("/auditData")
    R auditData(@Valid @RequestBody AuditMonthlyCardParam param);
}
