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

import cn.hutool.core.bean.BeanUtil;
import com.bonus.canteen.core.common.utils.SysUtil;
import com.bonus.common.houqin.constant.LeConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

@ApiModel("订单部分退单DTO")
public class OrderPartRefundDTO {
   @ApiModelProperty("是否为试算")
   private Integer ifTrial;
   @ApiModelProperty("订单id")
   private Long orderId;
   @ApiModelProperty("设备订单id")
   private String macOrderId;
   @ApiModelProperty("外部退单流水号（选填）")
   private String macRefundId;
   @ApiModelProperty("备注")
   private String remark;
   @ApiModelProperty("退款纠错图片 多个用逗号分割")
   private String resressPicurl;
   @ApiModelProperty("退单详情list")
   private @NotNull @Size(
   min = 1
) List<@Valid OrderDetailRefundDTO> detailRefundList;

   public void setResressPicurl(String resressPicurl) {
      this.resressPicurl = SysUtil.getCutPathMulti(resressPicurl);
   }

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

   public OrderPartRefundDTO() {
      this.ifTrial = LeConstants.COMMON_NO;
   }

   public Integer getIfTrial() {
      return this.ifTrial;
   }

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

   public String getMacOrderId() {
      return this.macOrderId;
   }

   public String getMacRefundId() {
      return this.macRefundId;
   }

   public String getRemark() {
      return this.remark;
   }

   public String getResressPicurl() {
      return this.resressPicurl;
   }

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

   public void setIfTrial(final Integer ifTrial) {
      this.ifTrial = ifTrial;
   }

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

   public void setMacOrderId(final String macOrderId) {
      this.macOrderId = macOrderId;
   }

   public void setMacRefundId(final String macRefundId) {
      this.macRefundId = macRefundId;
   }

   public void setRemark(final String remark) {
      this.remark = remark;
   }

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