package com.kym.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.kym.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户账户表
 * </p>
 *
 * @author skyline
 * @since 2023-08-09
 */
@Getter
@Setter
@TableName("t_wallet_detail")
@Accessors(chain = true)
public class WalletDetail extends BaseEntity implements Serializable {

    public static final int TYPE_充值 = 1;
    public static final int TYPE_退款 = 2;
    public static final int TYPE_消费 = 3;


    public static final int STATUS_待确认 = 0;
    public static final int STATUS_已确认 = 1;
    public static final int STATUS_已取消 = 2;

    private static final long serialVersionUID = 1L;


    /**
     * 用户id
     */
    private Long userId;

    /**
     * 交易类型:1-充值2-退款3-消费
     */
    private Integer type;

    /**
     * 币种
     */
    private String currency;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 金额
     */
    private Integer amount;

    /**
     * 赠款金额
     */
    private Integer grantsAmount;

    /**
     * 手续费
     */
    private Integer commission;

    /**
     * 余额变化前
     */
    private Integer beforeBalance;

    /**
     * 余额变化后
     */
    private Integer afterBalance;

    /**
     * 赠款余额变化前
     */
    private Integer beforeGrantsBalance;

    /**
     * 赠款余额变化后
     */
    private Integer afterGrantsBalance;

    /**
     * 交易id type为1是pay_log的id，type为3是wash_order的id
     */
    private String transactionId;

    /**
     * 交易发起时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime transactionTime;

    /**
     * 明细状态：0-待确认1-已确认2-已取消
     */
    private Integer status;

    /**
     * 来源: WX_PAY-微信支付, MANUAL-线下充值
     */
    private String source;

    /**
     * 关联充值优惠活动ID
     */
    private Long promotionId;

    /**
     * 备注
     */
    private String remark;

}
