package com.neusoft.smart.pos.dto.trade.response;

import com.neusoft.smart.pos.framework.utils.LocalDateTimeUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

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

/**
 * @author zcf
 * @date 2018-11-28 10：43
 * @description 资金预授权订单详情使用Response
 */
@ApiModel
@Data
@NoArgsConstructor
public class GetGrantOrderDetailResponse {

	@ApiModelProperty(name = "grantOrderNumber", value = "授权订单编号", dataType = "String" ,example="810825487965")
	public String grantOrderNumber;
	
	@ApiModelProperty(name = "authNo", value = "第三方支付平台资金授权订单号", dataType = "String" ,example="20181203850052274902")
	public String authNo;
	
	@ApiModelProperty(name = "seqNo", value = "当日订单序号", dataType = "BigDecimal" ,example="1")
	public Integer seqNo;

	@ApiModelProperty(name = "grantAmount", value = "授权金额", dataType = "BigDecimal" ,example="20.99")
	public BigDecimal grantAmount;
	
	@ApiModelProperty(name = "payAmount", value = "授权转支付金额(单位元)", dataType = "BigDecimal" ,example="20.99")
	public BigDecimal payAmount;
	
	@ApiModelProperty(name = "unfreezeAmount", value = "已解冻金额(单位元)", dataType = "BigDecimal" ,example="20.99")
	public BigDecimal unfreezeAmount;
	
	@ApiModelProperty(name = "payType", value = "付款方式编号@8:支付宝当面资金授权支付", dataType = "String" ,example="3")
	public String payType;
	
	@ApiModelProperty(name = "payTypeName", value = "付款方式名称", dataType = "String" ,example="3")
	public String payTypeName;
	
	@ApiModelProperty(name = "grantStatus", value = "授权状态@1:授权处理中@2:已授权@3:已解冻@4:已撤销", dataType = "String" ,example="1")
	public String grantStatus;
	
	@ApiModelProperty(name = "grantStatusName", value = "授权状态名称", dataType = "String" ,example="1")
	public String grantStatusName;
	
	@ApiModelProperty(name = "codeUrl", value = "支付二维码", dataType = "String" ,example="https://qr.alipay.com/aax03991punxtmtsdvgze5d")
	public String codeUrl;
	
	@ApiModelProperty(name = "refundNumber", value = "退单流水编号", dataType = "String" ,example="810825487965")
	public String refundNumber;
	
	@ApiModelProperty(name = "createdAt", value = "创建时间", dataType = "String" ,example="2018-05-26 18:55:45")
	public String createdAt;

	@ApiModelProperty(name = "grantTime", value = "授权完成时间", dataType = "String" ,example="2018-07-09 09:40:53")
	public String grantTime;
	
	@ApiModelProperty(name = "timeExpire", value = "订单失效时间", dataType = "String" ,example="2018-07-09 09:40:53")
	public Date timeExpire;
	
	@ApiModelProperty(name = "grantOrderDetailList", value = "授权订单明细列表", dataType = "List" ,example="")
	public List<GetGrantOrderTransactionResponse> grantOrderDetailList;
	
	public void setCreatedAt(Date createdAt) {
		this.createdAt = LocalDateTimeUtils.convertLocalDateTimeToString(LocalDateTimeUtils.convertDateToLocalDateTime(createdAt),LocalDateTimeUtils.DEFAULT_DATETIME_FORMAT);
	}
	
	public void setGrantTime(Date grantTime) {
		if(null == grantTime){
			this.grantTime = "";
		}else{
			this.grantTime = LocalDateTimeUtils.convertLocalDateTimeToString(LocalDateTimeUtils.convertDateToLocalDateTime(grantTime),LocalDateTimeUtils.DEFAULT_DATETIME_FORMAT);
		}
	}
	
}
