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

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@TableName("order_refund_detail")
public class OrderRefundDetail {
   private Long orderRefundId;
   private Long detailId;
   private Integer quantity;
   private BigDecimal refundAmount;
   private Integer realQuantity;
   private BigDecimal realRefundAmount;
   private Integer restoreQuantity;
   @DateTimeFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   @JsonFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   private LocalDateTime crtime;
   @DateTimeFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   @JsonFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   private LocalDateTime uptime;

   public OrderRefundDetail() {
   }

   public OrderRefundDetail(Long detailId, Integer quantity, Integer realQuantity) {
      this.detailId = detailId;
      this.quantity = quantity;
      this.realQuantity = realQuantity;
   }

   public OrderRefundDetail copyInstance() {
      return (OrderRefundDetail)BeanUtil.copyProperties(this, OrderRefundDetail.class, new String[0]);
   }

   public static OrderRefundDetail newDefaultInstance() {
      OrderRefundDetail orderRefundDetail = (new OrderRefundDetail()).setQuantity(1).setRefundAmount(BigDecimal.ZERO).setRealQuantity(0).setRealRefundAmount(BigDecimal.ZERO).setRestoreQuantity(0);
      return orderRefundDetail;
   }

   public static OrderRefundDetail newRefundedInstance(BigDecimal refundAmount) {
      OrderRefundDetail orderRefundDetail = (new OrderRefundDetail()).setQuantity(1).setRefundAmount(refundAmount).setRealQuantity(1).setRealRefundAmount(refundAmount).setRestoreQuantity(0);
      return orderRefundDetail;
   }

   public static String[] logFields() {
      return new String[]{"orderRefundId", "detailId", "quantity", "refundAmount", "realQuantity", "realRefundAmount", "restoreQuantity"};
   }

   public Long getOrderRefundId() {
      return this.orderRefundId;
   }

   public Long getDetailId() {
      return this.detailId;
   }

   public Integer getQuantity() {
      return this.quantity;
   }

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

   public Integer getRealQuantity() {
      return this.realQuantity;
   }

   public BigDecimal getRealRefundAmount() {
      return this.realRefundAmount;
   }

   public Integer getRestoreQuantity() {
      return this.restoreQuantity;
   }

   public LocalDateTime getCrtime() {
      return this.crtime;
   }

   public LocalDateTime getUptime() {
      return this.uptime;
   }

   public OrderRefundDetail setOrderRefundId(final Long orderRefundId) {
      this.orderRefundId = orderRefundId;
      return this;
   }

   public OrderRefundDetail setDetailId(final Long detailId) {
      this.detailId = detailId;
      return this;
   }

   public OrderRefundDetail setQuantity(final Integer quantity) {
      this.quantity = quantity;
      return this;
   }

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

   public OrderRefundDetail setRealQuantity(final Integer realQuantity) {
      this.realQuantity = realQuantity;
      return this;
   }

   public OrderRefundDetail setRealRefundAmount(final BigDecimal realRefundAmount) {
      this.realRefundAmount = realRefundAmount;
      return this;
   }

   public OrderRefundDetail setRestoreQuantity(final Integer restoreQuantity) {
      this.restoreQuantity = restoreQuantity;
      return this;
   }

   @JsonFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   public OrderRefundDetail setCrtime(final LocalDateTime crtime) {
      this.crtime = crtime;
      return this;
   }

   @JsonFormat(
      pattern = "yyyy-MM-dd HH:mm:ss"
   )
   public OrderRefundDetail setUptime(final LocalDateTime uptime) {
      this.uptime = uptime;
      return this;
   }
}
