package com.sqx.modules.sys.entity;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 钱包记录表
 * @TableName sys_user_money_details
 */
@TableName(value ="sys_user_money_details")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysUserMoneyDetails implements Serializable {

    public SysUserMoneyDetails(Long userId, Long sysUserId, Long byUserId, String title, Integer classify, Integer type,
                            Integer state, BigDecimal money, String content, Integer moneyType) {
        this.userId = userId;
        this.sysUserId = sysUserId;
        this.byUserId = byUserId;
        this.title = title;
        this.classify = classify;
        this.type = type;
        this.state = state;
        this.money = money;
        this.content = content;
        this.createTime = DateUtil.now();
        this.moneyType = moneyType;
    }
    /**
     * 钱包详情id
     */
    @TableId(type = IdType.ID_WORKER)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 渠道用户id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long sysUserId;

    /**
     * 对应用户id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long byUserId;

    /**
     * 标题
     */
    private String title;

    /**
     *     /***
     * 1 注册 （上级）
     * 2 充值
     * 3 购买
     * 4 提现
     * 5 现金大转盘
     * 6 分享达标
     * 7 任务领取
     * 8 平台操作
     * 9 订单退款
     * 10 渠道推广
     */
    private Integer classify;

    /**
     * 类别（1充值2支出）
     */
    private Integer type;

    /**
     * 状态 1待支付 2已到账 3取消
     */
    private Integer state;

    /**
     * 金额
     */
    private BigDecimal money;

    /**
     * 内容
     */
    private String content;

    /**
     * 金额类型： 1 红包，2金豆
     */
    private Integer moneyType;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 源id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long sourceId;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysUserMoneyDetails other = (SysUserMoneyDetails) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getSysUserId() == null ? other.getSysUserId() == null : this.getSysUserId().equals(other.getSysUserId()))
            && (this.getByUserId() == null ? other.getByUserId() == null : this.getByUserId().equals(other.getByUserId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getClassify() == null ? other.getClassify() == null : this.getClassify().equals(other.getClassify()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getMoney() == null ? other.getMoney() == null : this.getMoney().equals(other.getMoney()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getMoneyType() == null ? other.getMoneyType() == null : this.getMoneyType().equals(other.getMoneyType()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getSourceId() == null ? other.getSourceId() == null : this.getSourceId().equals(other.getSourceId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getSysUserId() == null) ? 0 : getSysUserId().hashCode());
        result = prime * result + ((getByUserId() == null) ? 0 : getByUserId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getClassify() == null) ? 0 : getClassify().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getMoney() == null) ? 0 : getMoney().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getMoneyType() == null) ? 0 : getMoneyType().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getSourceId() == null) ? 0 : getSourceId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", sysUserId=").append(sysUserId);
        sb.append(", byUserId=").append(byUserId);
        sb.append(", title=").append(title);
        sb.append(", classify=").append(classify);
        sb.append(", type=").append(type);
        sb.append(", state=").append(state);
        sb.append(", money=").append(money);
        sb.append(", content=").append(content);
        sb.append(", moneyType=").append(moneyType);
        sb.append(", createTime=").append(createTime);
        sb.append(", sourceId=").append(sourceId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
