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

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.util.List;

/**
 * @author zcf
 * @date 2018-03-13 10：45
 * @description POS端日交易汇总查询使用Response
 */
@ApiModel
@Data
public class GetPayChannelSummaryForPosResponse {

	@ApiModelProperty(name = "shopId", value = "门店ID", dataType = "Integer",example = "1")
	private Integer shopId;

	@ApiModelProperty(name = "shopName", value = "门店名称", dataType = "String",example = "门店1")
	private String shopName = "";

	@ApiModelProperty(name = "orderAmount", value = "实收总金额", dataType = "String",example = "100.00")
	private String totalAmount = "0.00";

	@ApiModelProperty(name = "payChannels", value = "支付渠道金额明细", dataType = "List")
	private List<PayChannel> payChannels;

	@Data
	@ApiModel
	public static class PayChannel{
		@ApiModelProperty(name = "payType", value = "支付方式编号", dataType = "String" ,example="1")
		public String payType;

		@ApiModelProperty(name = "payTypeName", value = "支付方式名称", dataType = "String" ,example="微信支付")
		public String payTypeName;

		@ApiModelProperty(name = "payAmount", value = "消费金额（元）", dataType = "String" ,example="198.22")
		public String payAmount = "0.00";

		@ApiModelProperty(name = "payCount", value = "消费笔数", dataType = "Integer" ,example="98")
		public Integer payCount = 0;

		@ApiModelProperty(name = "refundAmount", value = "退款金额（元）", dataType = "String" ,example="198.22")
		public String refundAmount = "0.00";

		@ApiModelProperty(name = "refundCount", value = "退款笔数", dataType = "Integer" ,example="98")
		public Integer refundCount = 0;

		@ApiModelProperty(name = "amount", value = "实收金额", dataType = "String" ,example="198.22")
		public String amount = "0.00";

		public void setPayAmount(BigDecimal payAmount) {
			this.payAmount = StringUtils.roundByScale(payAmount,2);
		}

		public void setRefundAmount(BigDecimal refundAmount) {
			this.refundAmount = StringUtils.roundByScale(refundAmount,2);
		}

		public void setAmount(BigDecimal amount) {
			this.amount = StringUtils.roundByScale(amount,2);
		}
	}

	public void setTotalAmount(BigDecimal totalAmount) {
		this.totalAmount = StringUtils.roundByScale(totalAmount,2);
	}
}
