package com.izouma.nineth.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.izouma.nineth.enums.AuthWay;
import com.izouma.nineth.enums.WithdrawStatus;
import io.swagger.annotations.Api;
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
@AllArgsConstructor
@NoArgsConstructor
@Table(indexes = {
        @Index(columnList = "userId"),
        @Index(columnList = "orderNo"),
})
@Builder
@Entity
@ApiModel("提现申请")
public class WithdrawApply extends BaseEntity{

    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("提现订单号")
    private String orderNo;

    @ApiModelProperty("提现用户")
    private Long userId;

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

    @ApiModelProperty("订单金额")
    private BigDecimal orderAmount;


    /**
     * 商户向用户收取服务费（可选）
     */
    @ApiModelProperty("服务费")
    private BigDecimal userFeeAmt;


    @ApiModelProperty("到账金额")
    private BigDecimal amount;

    /**
     *
     * 只做记录，可能是平台扣除的或用户的手续费
     *
     */
    @ApiModelProperty("手续费")
    private BigDecimal feeAmt;

    @ApiModelProperty("提现状态")
    @Enumerated(EnumType.STRING)
    private WithdrawStatus status;


    @JsonIgnore
    @ApiModelProperty("通知地址")
    private String notifyUrl;

    @ApiModelProperty("前端地址")
    private String frontUrl;


    @ApiModelProperty("通知时间")
    private LocalDateTime notifyTime;

    @ApiModelProperty("提现结果")
    private String result;

    @ApiModelProperty("提现银行卡编号")
    private String relatedCardNo;

    @ApiModelProperty("用户银行卡ID")
    private Long userBankCardId;

    @ApiModelProperty("银行卡名称")
    private String bankName;

    @ApiModelProperty("银行卡号")
    private String bankNo;

    @ApiModelProperty("跳转地址")
    private String jumpUrl;

    @ApiModelProperty("认证方式")
    @Enumerated(EnumType.STRING)
    private AuthWay authWay;

    @ApiModelProperty("支付授权令牌")
    private String token;

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

    @ApiModelProperty("完成时间")
    private LocalDateTime finishTime;

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


}
