package com.ghy.payment.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import com.ghy.common.enums.PayStatus;
import com.ghy.common.enums.PayTypeEnum;
import lombok.Data;

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

/**
 * @author clunt
 * 财务单主单(对应付款)
 */
@Data
public class FinancialMaster extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC)
    private Long id;

    @Excel(name = "商户ID", cellType = Excel.ColumnType.NUMERIC)
    private Long deptId;

    @Excel(name = "编码", cellType = Excel.ColumnType.STRING)
    private String code;

    @Excel(name = "主订单序号", cellType = Excel.ColumnType.NUMERIC)
    private Long orderMasterId;

    @Excel(name = "主订单编码", cellType = Excel.ColumnType.NUMERIC)
    private String orderMasterCode;

    @Excel(name = "整单总金额", cellType = Excel.ColumnType.STRING)
    private BigDecimal totalMoney;

    @Excel(name = "优惠金额", cellType = Excel.ColumnType.STRING)
    private BigDecimal discountMoney;

    @Excel(name = "实付金额", cellType = Excel.ColumnType.STRING)
    private BigDecimal payMoney;

    @Excel(name = "服务金额", cellType = Excel.ColumnType.STRING)
    private BigDecimal serverMoney;

    /**
     * @see PayTypeEnum
     */
    @Excel(name = "支付方式", cellType = Excel.ColumnType.NUMERIC)
    private Integer payType;

    /**
     * @see PayStatus
     */
    @Excel(name = "支付状态", cellType = Excel.ColumnType.NUMERIC)
    private Integer payStatus;

    @Excel(name = "付款时间", cellType = Excel.ColumnType.STRING)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;

    @Excel(name = "Adapay的唯一支付ID", cellType = Excel.ColumnType.STRING)
    private String paymentId;

    @Excel(name = "Adapay的撤销支付ID", cellType = Excel.ColumnType.STRING)
    private String reverseId;

    private List<Long> ids;

    private Integer type;

    private Long userId;

    private String orderCode;

    private List<FinancialDetail> details;

    private List<Long> orderMasterIds;

    public FinancialMaster() {
    }

    public FinancialMaster(String code, Long deptId, Long orderMasterId, String orderMasterCode, BigDecimal totalMoney, BigDecimal discountMoney, BigDecimal payMoney) {
        this.code = code;
        this.deptId = deptId;
        this.orderMasterId = orderMasterId;
        this.orderMasterCode = orderMasterCode;
        this.totalMoney = totalMoney;
        this.discountMoney = discountMoney;
        this.payMoney = payMoney;
    }
}
