package com.bonus.core.order.custom;

import cn.hutool.core.collection.CollUtil;
import com.bonus.core.common.custom.business.CustomBusiness;
import com.bonus.core.order.common.constants.OrderRefundBizEnum;
import com.bonus.core.order.common.dto.OrderRefundParam;
import com.bonus.core.order.common.model.OrderDetail;
import com.bonus.core.order.common.model.OrderInfo;
import com.bonus.core.order.common.model.OrderRefund;
import com.bonus.core.order.common.model.OrderRefundDetail;
import com.bonus.core.order.common.vo.OrderRefundResultVO;
import com.bonus.core.pay.api.dto.UnifyRefundDTO;
import com.bonus.core.pay.api.vo.UnifyRefundVO;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class OrderCustomRefundBusiness implements CustomBusiness {
   public String name() {
      return "订单（退款/取消）";
   }

   public List<CustomBusiness.Version> versions() {
      return CollUtil.newArrayList(new CustomBusiness.Version[]{CustomBusiness.Version.of("3.7.0", "初版"), CustomBusiness.Version.of("3.7.6", "埋点参数添加业务类型")});
   }

   public boolean willCancelOrder(OrderInfo orderInfo) {
      return true;
   }

   public void didCancelOrder(OrderInfo orderInfo) {
   }

   public boolean willCheckOrderRefund(OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefundParam refundParam, OrderRefundBizEnum biz) {
      return true;
   }

   public void didCheckOrderRefund(OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefundParam refundParam, OrderRefundBizEnum biz) {
   }

   public void didPackageRefundInfo(OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefund orderRefund, List<OrderRefundDetail> orderRefundDetailList, OrderRefundParam refundParam, OrderRefundBizEnum biz) {
   }

   public void didCalcRefundDetailAmountV2(OrderInfo orderInfo, List<OrderDetail> orderDetailList, OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList, BigDecimal customRefundAmount, boolean needCheckFlag, OrderRefundBizEnum biz) {
   }

   public void didCalcRefundFeeAmountV2(OrderInfo orderInfo, List<OrderDetail> orderDetailList, OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList, OrderRefundBizEnum biz) {
   }

   public void willSaveRefund(OrderInfo orderInfo, List<OrderDetail> detailList, List<OrderRefund> orderRefundList, List<OrderRefundDetail> orderRefundDetailList, OrderRefundBizEnum biz) {
   }

//   public void willCheckRefund(OrderCheckDTO orderCheckDTO, OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefund orderRefund, List<OrderRefundDetail> orderRefundDetailList) {
//   }

   public void willPayRefund(UnifyRefundDTO payRefundDTO, OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefund orderRefund, List<OrderRefundDetail> orderRefundDetailList, OrderRefundBizEnum biz) {
   }

   public OrderRefundResultVO willHandleRefundResultV2(UnifyRefundVO refundVO, OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefund orderRefund, List<OrderRefundDetail> orderRefundDetailList) {
      return null;
   }

   public OrderRefundResultVO didHandleRefundResult(UnifyRefundVO refundVO, OrderInfo orderInfo, List<OrderDetail> detailList, OrderRefund orderRefund, List<OrderRefundDetail> orderRefundDetailList, OrderRefundResultVO resultVO) {
      return resultVO;
   }
}
