package com.izouma.nineth.domain;

import com.izouma.nineth.enums.DivStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "div_money", indexes = {
        @Index(columnList = "userId"),
        @Index(columnList = "orderId"),
})
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("分账记录")
public class DivMoney extends BaseEntity{

    @Column(nullable = false)
    @ApiModelProperty("订单ID")
    private Long orderId;

    @ApiModelProperty("用户ID")
    private Long userId;

    /**
     * 支付平台关联标识
     */
    @ApiModelProperty("会员ID")
    private String memberId;

    @ApiModelProperty("第三方账户ID")
    private String thirdAccountId;

    @ApiModelProperty("订单总金额")
    @Column(precision = 10, scale = 2)
    private BigDecimal orderAmount;

    @ApiModelProperty("分账总金额")
    @Column(precision = 10, scale = 2)
    private BigDecimal totalAmount;

    @ApiModelProperty("分账金额")
    @Column(precision = 10, scale = 2)
    private BigDecimal amount;

    @ApiModelProperty("分账比例")
    private Integer ratio;

    @ApiModelProperty("剩余金额")
    @Column(precision = 10, scale = 2)
    private BigDecimal restAmount;

    @ApiModelProperty("是否承担手续费")
    private boolean feeFlag;

    @ApiModelProperty("状态")
    @Enumerated(EnumType.STRING)
    private DivStatus status;


    @ApiModelProperty("处理时间")
    private LocalDateTime processTime;

    /**
     * 支付平台
     */
    @ApiModelProperty("支付平台")
    private String payPlatform;


    /**
     * 转账交易ID
     */
    @ApiModelProperty("转账交易ID")
    private Long transferMoneyId;

    /**
     * 转账结果
     */
    @ApiModelProperty("转账结果")
    private String transferResult;

    @ApiModelProperty("用户资金账户")
    private Long userFundAccountId;

    /**
     *
     * 导出提示,支付时间
     *
     */
    @Transient
    private LocalDateTime exportPayTime;

    /**
     *
     * 导出提示,状态结果
     *
     */
    @Transient
    private String exportTips;

    /**
     * 分账用户银行卡
     */
    @Transient
    private String transferBankNo;

    /**
     * 分账用户名称
     */
    @Transient
    private String transferBankName;



}
