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

import com.yuchen.saas.payment.api.dto.FindOrderManageReqDTO;
import com.yuchen.saas.payment.api.dto.PageMoreOrderRefundRecordReqDTO;
import com.yuchen.saas.payment.api.dto.PageOrderManageReqDTO;
import com.yuchen.saas.payment.api.dto.SiteListDataDTO;
import com.yuchen.saas.payment.api.dto.order.*;
import com.yuchen.saas.payment.api.entity.OrderManage;
import com.yuchen.saas.payment.api.vo.OrderManageInvoiceRecordDataVO;
import com.yuchen.saas.payment.api.vo.OrderManageVO;
import com.yuchen.saas.payment.api.vo.moreOrderRefund.OrderRefundVO;
import com.yuchen.saas.payment.api.vo.moreOrderRefund.OrderRefundableCostDetailVO;
import com.yuchen.saas.payment.api.vo.moreOrderRefund.PmgBatParkPayMoreOrderRefundRecordVO;
import com.yuchen.saas.payment.api.vo.orderCenter.*;
import io.swagger.annotations.ApiOperation;
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;

/**
 * @description: 订单管理接口
 * @author mqs
 * @date 2023/5/18 15:39
 * @version 1.0
 */
@FeignClient(
        value = AppNameConstant.SAAS_PAYMENT,
        fallbackFactory = OrderManageFeignServiceFallback.class
)
public interface OrderManageFeignService {

    /**
     * @description  发送订单管理MQ异步消息
     * @author  mqs
     * @date    2023/5/29 14:04
     * @param	orderManageVO
     * @return  org.nest.springwrap.core.tool.api.R
     */
    @PostMapping("/orderManage/sendOrderMqAsync")
    R sendOrderMqAsync(@RequestBody OrderManageVO orderManageVO);

    /**
     * @description: 订单管理 新增
     * @author mqs
     * @date 2023/5/18 15:24
     * @version 1.0
     */
    @PostMapping("/orderManage/save")
    R createOrderManage(@RequestBody OrderManageVO orderManageVO);

    /**
     * @description: 订单管理 更新
     * @author mqs
     * @date 2023/5/18 15:49
     * @version 1.0
     */
    @PostMapping("/orderManage/update")
    R update(@RequestBody OrderManage orderManage);

    /**
     * @description: 订单管理 删除
     * @author mqs
     * @date 2023/5/18 15:50
     * @version 1.0
     */
    @PostMapping("/orderManage/remove")
    R remove(@RequestParam String id);

    /**
     * @description: 详情
     * @author mqs
     * @date 2023/5/18 15:50
     * @version 1.0
     */
    @PostMapping("/orderManage/detail")
    R detail(@RequestParam String id);

    /**
     * @description: 分页查询
     * @author mqs
     * @date 2023/5/18 15:50
     * @version 1.0
     */
    @PostMapping("/orderManage/page")
    R<NestPage<OrderManage>> page(@RequestBody PageOrderManageReqDTO pageOrderManageReqDTO);

    /**
     * 订单管理 - 全部订单
     */
    @PostMapping("/orderManage/pageOrderAllData")
    R<NestPage<OrderAllDataVO>> pageOrderAllData(@Validated @RequestBody UserOrderReqDTO reqDTO);

    /**
     * 订单管理 - 待支付
     */
    @PostMapping("/orderManage/pageOrderUnpaidData")
    R<NestPage<OrderUnpaidVO>> pageUnpaid(@Validated @RequestBody UserOrderReqDTO reqDTO);

    /**
     * 订单管理 - 已支付
     */
    @PostMapping("/orderManage/pageOrderPaidData")
    R<NestPage<OrderPaidVO>> pageOrderPaid(@Validated @RequestBody UserOrderReqDTO reqDTO);

    /**
     * 订单管理 - 已关闭
     */
    @PostMapping("/orderManage/pageOrderCloseData")
    R<NestPage<OrderUnpaidVO>> pageOrderClose(@Validated @RequestBody UserOrderReqDTO reqDTO);

    /**
     * 订单管理 - 已关闭
     */
    @PostMapping("/orderManage/pageOrderUnderWayData")
    R<NestPage<OrderUnpaidVO>> pageOrderUnderWayData(@Validated @RequestBody UserOrderReqDTO reqDTO);

    /**
     * 订单管理 - 取消订单
     */
    @PostMapping("/orderManage/cancelOrderData")
    R<Boolean> cancelOrderData(@Validated @RequestBody CancelOrderDataReqDTO reqDTO);

    /**
     * 订单管理 - 退款记录
     */
    @PostMapping("/orderManage/pageOrderRefundData")
    R<NestPage<PmgBatParkPayMoreOrderRefundRecordVO>> pageOrderRefundData(@RequestBody PageMoreOrderRefundRecordReqDTO reqDTO);


    /**
     * 订单管理 - 退款记录详情
     */
    @GetMapping("/orderManage/getOrderRefundData/{id}")
    R<OrderRefundRecordDetailVO> getOrderRefundData(@PathVariable Long id);
    @GetMapping("/orderManage/getOrderManageRefundRecordData/{orderNo}")
    @ApiOperation(value = "获取订单退款详情", notes = "获取订单退款详情")
    R<List<OrderRefundVO>> getOrderManageRefundRecordData(@PathVariable String orderNo) ;
    @PostMapping("/orderManage/verifyRefundInfoData")
    @ApiOperation(value = "订单管理 - 提交退款信息确认-计算各费用项可退金额", notes = "订单管理 - 提交退款信息确认-计算各费用项可退金额")
     R<OrderRefundableCostDetailVO> verifyRefundInfoData(@Validated @RequestBody VerifyRefundInfoReqDTO reqDTO);
    /**
     * 订单管理 - 退款信息确认
     */
    @PostMapping("/orderManage/verifyRefundInfo")
    R<Long> verifyRefundInfo(@Validated @RequestBody VerifyRefundInfoReqDTO reqDTO);

    /**
     * 订单管理 - 临停退款申请
     */
    @PostMapping("/orderManage/applyStoppingOrderRefundProcess")
    R<Boolean> applyStoppingOrderRefundProcess(@Validated @RequestBody ApplyStoppingOrderRefundReqDTO reqDTO);

    /**
     * 退款/售后-获取退款审核列表
     */
    @PostMapping("/orderManage/pageRefundAuditData")
    R<NestPage<OrderRefundAuditVO>> pageRefundAuditData(@RequestBody OrderRefundAuditReqDTO reqDTO);

    /**
     * 退款/售后-获取退款审核详情
     */
    @PostMapping("/orderManage/getRefundAuditDetail/{id}")
    R<OrderRefundAuditVO> getRefundAuditDetail(@PathVariable Long id);

    /**
     * 退款/售后-取消退款
     */
    @PostMapping("/orderManage/cancelStoppingOrderRefund/{id}")
    R<Boolean> cancelStoppingOrderRefund(@PathVariable Long id);

    /**
     * 获取充电或占位费详情
     * @return 充电或占位费详情
     */
    @GetMapping("/orderManage/getStoppingOrOccupancyDetailById/{id}")
    R<OrderManageDetailVO> getStoppingOrOccupancyDetailById(@PathVariable Long id);

    /**
     * 获取充电或占位费详情
     * @return 充电或占位费详情
     */
    @GetMapping("/orderManage/getStoppingOrOccupancyDetailByIdV2/{id}")
    R<OrderManageDetailVO> getStoppingOrOccupancyDetailByIdV2(@PathVariable Long id);

    /**
     * 根据订单id获取订单详情
     * @return 订单详情
     */
    @GetMapping("/orderManage/getOrderManageInfoData/{id}")
    R<OrderManageInfoDataVO> getOrderManageInfoData(@PathVariable Long id);

    /**
     * 根据支付订单号及账单id获取订单详情
     * @return 订单详情
     */
    @GetMapping("/getOrderInfoByPayNoAndBillNo/{payNo}/{billId}")
    R<OrderManageInfoDataVO> getOrderInfoByPayNoAndBillNo(@PathVariable String payNo, @PathVariable String billId);

    /**
     * 创建进行中订单管理信息
     * @return 创建进行中订单管理信息
     */
    @PostMapping("/orderManage/createOrderManageInfoData")
    R<OrderManage> createOrderManageInfoData(@Validated @RequestBody CreateOrderManageReqDTO reqDTO);

    /**
     * 创建已完成订单管理信息
     * @return 创建已完成订单管理信息
     */
    @PostMapping("/orderManage/createCompletedOrderData")
    R<OrderManage> createCompletedOrderData(@Validated @RequestBody CreateCompletedOrderReqDTO reqDTO);

    /**
     * 更新进行中-待支付订单管理信息
     * @return 创建订单管理信息
     */
    @PostMapping("/orderManage/updateOrderManageInfoData")
    R<Boolean> updateOrderManageInfoData(@Validated @RequestBody CreateOrderManageReqDTO reqDTO);

    /**
     * 优惠卷直接抵扣&&无感支付-创建已完成订单
     * @return 创建订单管理信息
     */
    @PostMapping("/orderManage/noFeelPayCreateOrderData")
    R<OrderManage> noFeelPayCreateOrderData(@Validated @RequestBody NoFeelPayCreateOrderDataReqDTO reqDTO);

    /**
     * 异常关闭订单管理信息
     * @return 异常关闭订单管理信息
     */
    @PostMapping("/orderManage/exceptionCloseOrderData")
    R<Boolean> exceptionCloseOrderData(@RequestBody CreateOrderManageReqDTO reqDTO);

    @PostMapping("/orderManage/getOrderManageListByBillIdList")
    R<List<OrderManage>> getOrderManageListByBillIdList(@RequestBody FindOrderManageReqDTO reqDTO);

    @GetMapping("/orderManage/listByBillNos")
    R<List<OrderManage>> listByBillNos(@RequestParam List<Long> billNos);

    /**
     * 小程序->我的卡券中心->根据优惠券ID获取订单信息
     */
    @GetMapping("/orderManage/getOrderInfoByCouponRecordId/{couponRecordId}")
    R<OrderInfoVO> getOrderInfoByCouponRecordId(@PathVariable("couponRecordId") Long couponRecordId);
    @GetMapping("/orderManage/getOrderManageInvoiceRecordData/{orderId}")
    @ApiOperation(value = "获取订单发票记录详情", notes = "获取订单发票记录详情")
     R<List<OrderManageInvoiceRecordDataVO>> getOrderManageInvoiceRecordData(@ApiParam(name = "订单id",value = "订单id") @PathVariable("orderId") Long orderId) ;

    @GetMapping("/orderManage/getOrderDetails/{orderType}/{billId}")
    @ApiOperation(value = "获取详情", notes = "获取详情")
    public R<OrderManage> getOrderDetails(@PathVariable("billId") Long billId,@PathVariable("orderType") Integer orderType);

    @GetMapping("/orderManage/getAllSiteListDataByOperator")
    R<List<SiteListDataDTO>> getAllSiteListByOperator(@RequestParam(required = false) Long operator);

    /**
     * 根据优惠券id集合获取订单信息
     * @param couponRecordIdList
     * @return
     */
    @GetMapping("/orderManage/getOrderInfoByCouponRecordIdList")
    R<List<OrderCouponInfoVO>> getOrderInfoByCouponRecordIdList(@RequestParam() List<Long> couponRecordIdList);
    /**
     * 根据订单号获取订单信息
     * @param orderNo
     * @return
     */
    @GetMapping("/orderManage/getOrderInfoByOrderNo/{orderNo}")
    R<List<OrderManage>> getOrderInfoByOrderNo(@PathVariable("orderNo") String orderNo);
}
