package com.fzm.mall.server.front.asset.model;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;

import com.fzm.mall.server.front.util.UUIdUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 用户资产变更记录表
 * </p>
 *
 * @author fzm
 * @since 2021-05-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="UserAssetRecord对象", description="用户资产变更记录表")
public class UserAssetRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final Integer STATUS_FAIL = 1;
    public static final Integer STATUS_SUCCESS = 2;

    @ApiModelProperty(value = "用户资产变更表自增id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "流水号")
    private String flowId;

    @ApiModelProperty(value = "用户uid")
    private String uid;

    @ApiModelProperty(value = "变更资产名称（如:btc、金币）")
    private String coin;

    @ApiModelProperty(value = "1、支付宝转账-转入 2、支付宝转账-转出 3、微信转账-转入 4、微信转账-转出 5、数字资产转帐-转入 6、数字资产转账-转出 " +
            "7、充值 8、提现 9、支付 10、退款 11、销售 12、发行 13、增发 14、回收 15、减发 16、提币 17.扣除 18、提货  19评论奖励 20转赠-转入 21转赠-转出 22邀请注册  23 注册奖励")
    private Integer type;

    @ApiModelProperty(value = "变更资产金额")
    private BigDecimal amount;

    @ApiModelProperty(value = "流水状态（1.失败 2.成功）")
    private Integer status;

    @ApiModelProperty(value = "资产来源(如果是RMB资产，则对方为用户编号，如果是数字资产，则为对方的数字货币地址；如果是平台，则用“平台”即可)")
    private String otherSide;

    @ApiModelProperty(value = "信息入库时间")
    @TableField(fill = FieldFill.INSERT)
    private Long createTime;

    @ApiModelProperty(value = "信息更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateTime;

    @TableField("hash")
    private String hash;

    @ApiModelProperty(value = "备注")
    private String note;

    @ApiModelProperty(value = "商品coin")
    private String goodsCoin;

    public void init(String uid, String coin, Integer type, BigDecimal amount, Integer status, String otherSide, String hash, String note) {
        setFlowId(UUIdUtil.getUUID());
        setUid(uid);
        setCoin(coin);
        setType(type);
        setAmount(amount);
        setStatus(status);
        setOtherSide(otherSide);
        setHash(hash);
        setNote(note);
    }
}
