package com.bonus.canteen.core.order.web.dto;

import cn.hutool.core.bean.BeanUtil;
import com.bonus.canteen.core.order.common.dto.OrderDetailRefundDTO;
import com.bonus.canteen.core.order.common.dto.OrderRefundParam;
import com.bonus.canteen.core.pay.api.dto.UnifyRefundDTO;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Min;
import java.math.BigDecimal;
import java.util.List;

public class OrderRefundSubmitWebDTO {
   @ApiModelProperty("订单id")
   private Long orderId;
   @ApiModelProperty("本次退单金额（默认不传则自动计算）")
   private @Min(0L) BigDecimal refundAmount;
   @ApiModelProperty("恢复库存 1是 2否")
   private Integer restoreInventory;
   @ApiModelProperty("扩展字段")
   private JsonNode extParam;
   @ApiModelProperty("退单详情list")
   private List<OrderDetailRefundDTO> detailRefundList;
   @ApiModelProperty("指定退款渠道详情")
   private List<UnifyRefundDTO.ChannelDetail> channelAssignList;

   public OrderRefundParam convertToOrderRefundParam() {
      OrderRefundParam orderRefundParam = BeanUtil.copyProperties(this, OrderRefundParam.class, new String[0]);
      return orderRefundParam;
   }

   public Long getOrderId() {
      return this.orderId;
   }

   public BigDecimal getRefundAmount() {
      return this.refundAmount;
   }

   public Integer getRestoreInventory() {
      return this.restoreInventory;
   }

   public JsonNode getExtParam() {
      return this.extParam;
   }

   public List<OrderDetailRefundDTO> getDetailRefundList() {
      return this.detailRefundList;
   }

   public List<UnifyRefundDTO.ChannelDetail> getChannelAssignList() {
      return this.channelAssignList;
   }

   public void setOrderId(final Long orderId) {
      this.orderId = orderId;
   }

   public void setRefundAmount(final BigDecimal refundAmount) {
      this.refundAmount = refundAmount;
   }

   public void setRestoreInventory(final Integer restoreInventory) {
      this.restoreInventory = restoreInventory;
   }

   public void setExtParam(final JsonNode extParam) {
      this.extParam = extParam;
   }

   public void setDetailRefundList(final List<OrderDetailRefundDTO> detailRefundList) {
      this.detailRefundList = detailRefundList;
   }

   public void setChannelAssignList(final List<UnifyRefundDTO.ChannelDetail> channelAssignList) {
      this.channelAssignList = channelAssignList;
   }
}
