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


import com.bonus.canteen.core.pay.api.vo.UnifyPayVO;
import com.bonus.canteen.core.pay.common.model.TradeRecord;

import java.time.LocalDateTime;

public class OrderDidPayInfoDTO {
   private Integer payState;
   private Integer payType;
   private Integer payChannel;
   private LocalDateTime payTime;

   public static OrderDidPayInfoDTO of(Integer payState, Integer payType, Integer payChannel) {
      return new OrderDidPayInfoDTO(payState, payType, payChannel, LocalDateTime.now());
   }

   public static OrderDidPayInfoDTO of(UnifyPayVO payVO) {
      return new OrderDidPayInfoDTO(payVO.getCode(), payVO.getPayType(), payVO.getPayChannel(), payVO.getPayTime());
   }

   public static OrderDidPayInfoDTO of(TradeRecord tradeRecord) {
      return new OrderDidPayInfoDTO(tradeRecord.getTradeState(), tradeRecord.getPayType(), tradeRecord.getPayChannel(), tradeRecord.getTradeTime());
   }

   public Integer getPayState() {
      return this.payState;
   }

   public Integer getPayType() {
      return this.payType;
   }

   public Integer getPayChannel() {
      return this.payChannel;
   }

   public LocalDateTime getPayTime() {
      return this.payTime;
   }

   public void setPayState(final Integer payState) {
      this.payState = payState;
   }

   public void setPayType(final Integer payType) {
      this.payType = payType;
   }

   public void setPayChannel(final Integer payChannel) {
      this.payChannel = payChannel;
   }

   public void setPayTime(final LocalDateTime payTime) {
      this.payTime = payTime;
   }


   public OrderDidPayInfoDTO() {
   }

   public OrderDidPayInfoDTO(final Integer payState, final Integer payType, final Integer payChannel, final LocalDateTime payTime) {
      this.payState = payState;
      this.payType = payType;
      this.payChannel = payChannel;
      this.payTime = payTime;
   }
}
