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 lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author zcf
 * @date 2018-11-01 16：20
 * @description 商户未结算信息查询使用Response
 */
@Data
@ApiModel
@NoArgsConstructor
public class GetBillResponse implements Serializable {
    
    @ApiModelProperty(name = "acceptFlag", value = "是否可归档@0:不可归档@1:可归档", dataType = "String")
    private String acceptFlag;
    
    @ApiModelProperty(name = "billNumber", value = "账单编号(根据结算周期命名20181031)", dataType = "String")
    private String billNumber;

    @ApiModelProperty(name = "billName", value = "账单名称(结算周期起止时间命名20181001-20181031)", dataType = "String")
    private String billName;

    @ApiModelProperty(name = "orgId", value = "组织机构Id", dataType = "int")
    private Integer orgId;

    @ApiModelProperty(name = "shopId", value = "门店Id", dataType = "int")
    private Integer shopId;
    
    @ApiModelProperty(name = "shopName", value = "门店名称", dataType = "String")
    private String shopName;

    @ApiModelProperty(name = "billAmount", value = "账单总金额", dataType = "double")
    private String billAmount;

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

    @ApiModelProperty(name = "acceptStatus", value = "归档状态@1:未归档@2:已归档", dataType = "String")
    private String acceptStatus;

    @ApiModelProperty(name = "remark", value = "备注", dataType = "String")
    private String remark;

    @ApiModelProperty(name = "acceptTime", value = "归档时间(时间毫秒)", dataType = "long")
    private Long acceptTime;

    @ApiModelProperty(name = "cycleStartTime", value = "结算周期开始时间(大于等于)", dataType = "long")
    private Long cycleStartTime;

    @ApiModelProperty(name = "cycleEndTime", value = "结算周期结束时间(小于等于)", dataType = "long")
    private Long cycleEndTime;
    
    @ApiModelProperty(name = "billSubjectList", value = "分润主体列表", dataType = "list")
    private List<BillSubject> billSubjectList = new ArrayList<>();

    public void setAcceptTime(Date acceptTime) {
        this.acceptTime = acceptTime.getTime();
    }

    public void setCycleStartTime(Date cycleStartTime) {
        this.cycleStartTime = cycleStartTime.getTime();
    }

    public void setCycleEndTime(Date cycleEndTime) {
        this.cycleEndTime = cycleEndTime.getTime();
    }

    public void setBillAmount(BigDecimal billAmount) {
        this.billAmount = StringUtils.roundByScale(billAmount,2);
    }
    
    @Data
    @ApiModel
    public static class BillSubject{
        
        @ApiModelProperty(name = "subjectName", value = "分润主体名称", dataType = "String" ,example="微信支付")
        public String subjectName;
        
        @ApiModelProperty(name = "profitAmount", value = "分润金额", dataType = "String" ,example="198.22")
        public String profitAmount = "0.00";
        
        @ApiModelProperty(name = "payCount", value = "消费笔数", dataType = "Integer" ,example="98")
        public Integer payCount = 0;
        
        @ApiModelProperty(name = "billPayTypeList", value = "账单支付方式列表", dataType = "list")
        private List<BillPayType> billPayTypeList = new ArrayList<>();
    
        public void setProfitAmount(BigDecimal profitAmount) {
            this.profitAmount = StringUtils.roundByScale(profitAmount,2);
        }
    }
    
    @Data
    @ApiModel
    public static class BillPayType{
        @ApiModelProperty(name = "payType", value = "支付方式编号", dataType = "String" ,example="1")
        public String payType;
        
        @ApiModelProperty(name = "payTypeName", value = "支付方式名称", dataType = "String" ,example="微信支付")
        public String payTypeName;
        
        @ApiModelProperty(name = "profitAmount", value = "账单总金额", dataType = "String" ,example="198.22")
        public String profitAmount = "0.00";
    
        @ApiModelProperty(name = "payCount", value = "消费笔数", dataType = "Integer" ,example="98")
        public Integer payCount = 0;
    
        public void setProfitAmount(BigDecimal profitAmount) {
            this.profitAmount = StringUtils.roundByScale(profitAmount,2);
        }
    
    }
    
}