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

import com.neusoft.smart.pos.framework.bean.PaginationExtendBean;
import com.neusoft.smart.pos.framework.utils.DateUtils;
import com.neusoft.smart.pos.framework.utils.LocalDateTimeUtils;
import com.neusoft.smart.pos.framework.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author zcf
 * @date 2018-03-06 09：39
 * @description POS端日交易流水查询使用Response
 */
@ApiModel
@Data
public class GetShopOrderDetailsForPosResponse {


	@ApiModelProperty(name = "orderAmount", value = "总金额（元）", dataType = "BigDecimal" ,example="198.22")
	public String totalAmount = "0.00";

	@ApiModelProperty(name = "totalMemberPoint", value = "门店订单列表分页数据", dataType = "BigDecimal" ,example="198")
	public PaginationExtendBean<ShopOrderDetail> paginationExtendBean;

	@Data
	@ApiModel
	public static class ShopOrderDetail{

		@ApiModelProperty(name = "orderNumber", value = "订单编号", dataType = "String" ,example="门店1")
		public String orderNumber = "";

		@ApiModelProperty(name = "orderAmount", value = "今日总金额（元）", dataType = "String" ,example="198.22")
		public String orderAmount = "0.00";

		@ApiModelProperty(name = "realPayAmount", value = "今日实付总金额（元）", dataType = "String" ,example="198.22")
		public String realPayAmount = "0.00";

		@ApiModelProperty(name = "payType", value = "付款方式编号@1:微信支付@2:支付宝支付@3:银行卡支付@4:微信转账@:5支付宝转账@6:现金支付@7:会员卡支付@8:当面资金授权支付@9:银联二维码支付", dataType = "String" ,example="1")
		public String payType = "";

		@ApiModelProperty(name = "payTypeName", value = "付款方式名称@1:微信支付@2:支付宝支付@3:银行卡支付@4:微信转账@:5支付宝转账@6:现金支付@7:会员卡支付@8:当面资金授权支付@9:银联二维码支付", dataType = "String" ,example="微信支付")
		public String payTypeName = "";

		@ApiModelProperty(name = "orderStatus", value = "订单状态(@1:待付款@2:已付款@3:退款中@4:已退款@5:订单取消)", dataType = "String" ,example="1")
		public String orderStatus;

		@ApiModelProperty(name = "orderStatusName", value = "订单状态(@1:待付款@2:已付款@3:退款中@4:已退款@5:订单取消)", dataType = "String" ,example="代付款")
		public String orderStatusName;

		@ApiModelProperty(name = "retrvlRefNo", value = "原交易参考号(银行卡支付专用)", dataType = "String" ,example="22163131")
		public String retrvlRefNo;

		@ApiModelProperty(name = "oriTraceNo", value = "原交易凭证号(银行卡支付专用)", dataType = "String" ,example="22163131")
		public String oriTraceNo;

		@ApiModelProperty(name = "transDate", value = "交易时间(银行卡支付专用)", dataType = "String" ,example="0426")
		public String transDate;

		@ApiModelProperty(name = "oriBatchNo", value = "原批次号(银行卡支付专用)", dataType = "String" ,example="0426")
		public String oriBatchNo;

		@ApiModelProperty(name = "createdAt", value = "创建时间", dataType = "String" ,example="2018-05-26 18:55:45")
		public String createdAt;

		public void setCreatedAt(Date createdAt) {
			this.createdAt = LocalDateTimeUtils.convertLocalDateTimeToString(LocalDateTimeUtils.convertDateToLocalDateTime(createdAt),LocalDateTimeUtils.DEFAULT_DATETIME_FORMAT);
		}

        public void setOrderAmount(long orderAmount) {
            this.orderAmount = "" + new BigDecimal(("" + orderAmount).toString()).divide(new BigDecimal(100)).doubleValue();
        }

		public void setRealPayAmount(long realPayAmount) {
			this.realPayAmount = "" + new BigDecimal(("" + realPayAmount).toString()).divide(new BigDecimal(100)).doubleValue();
		}
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = "" + totalAmount;
    }
}
