package com.izouma.nineth.domain;

import com.izouma.nineth.annotations.Searchable;
import com.izouma.nineth.enums.TransferMethod;
import com.izouma.nineth.enums.TransferStatus;
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 = "transfer_money_info", indexes = {
        @Index(columnList = "tradeNo", unique = true),
        @Index(columnList = "toUserId"),
})
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel("转账交易记录")
public class TransferMoneyInfo extends BaseEntity{

    @ApiModelProperty("交易编号")
    private String tradeNo;

    @ApiModelProperty("目标用户ID")
    private Long toUserId;

    @ApiModelProperty("转账方式")
    @Enumerated(EnumType.STRING)
    private TransferMethod transferMethod;

    @ApiModelProperty("账户类型")
    private String accountType;

    @Searchable
    @ApiModelProperty("账户号")
    private String accountNo;

    @Searchable
    @ApiModelProperty("账户名称")
    private String accountName;

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

    @ApiModelProperty("转账订单ID")
    private String transferOrderId;

    /**
     * 流水ID
     */
    @ApiModelProperty("交易流水ID")
    private String transactionId;

    @ApiModelProperty("转账时间")
    private String transferDate;

    @ApiModelProperty("转账状态")
    @Enumerated(EnumType.STRING)
    private TransferStatus status;

    @ApiModelProperty("转账结果")
    private String result;

    /**
     * 第三方账户ID
     */
    private String thirdAccountId;

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

    /**
     * 转账理由
     */
    private String reason;

    /**
     * 分账记录ID
     */
    private Long divMoneyId;

    /**
     * 批次号
     *
     */
    private String batchNo;

    /**
     * 完成时间
     */
    private LocalDateTime finishTime;



}
