package cn.van333.mt2ql.wxMessage.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.List;

import lombok.Data;
/**
 * @author Leo
 * @version 1.0
 * @create 2023/12/19 0019 上午 11:46
 * @description：
 * 收到群聊消息 (10008)
 * 收到私聊消息 (10009)
 * 自己发出消息 (10010)
 */
/**
 *
 * @TableName wx_message_data_for_chat
 */
@TableName(value ="wx_message_data_for_chat")
@Data
public class WxMessageDataForChat implements Serializable {
    /**
     * 收到这条消息的13位现行时间戳
     */
    private Long timestamp;

    /**
     * 来源类型：1|私聊 2|群聊 3|公众号
     */
    private Integer fromtype;

    /**
     * 消息类型：1|文本 3|图片 34|语音 42|名片 43|视频 47|动态表情 48|地理位置 49|分享链接或附件 2001|红包 2002|小程序 2003|群邀请 10000|系统消息
     */
    private Integer msgtype;

    /**
     * 消息来源：0|别人发送 1|自己手机发送
     */
    private Integer msgsource;

    /**
     * fromType=1时为好友wxid，fromType=2时为群wxid，fromType=3时公众号wxid
     */
    private String fromwxid;

    /**
     * 仅fromType=2时有效，为群内发言人wxid
     */
    private String finalfromwxid;

    /**
     * 仅fromType=2，且msgSource=0时有效，为消息中艾特人wxid列表
     */
    private String atwxidlist;

    /**
     * 仅fromType=2时有效，0
     */
    private Integer silence;

    /**
     * 仅fromType=2时有效，群成员数量
     */
    private Integer membercount;

    /**
     * 消息签名
     */
    private String signature;

    /**
     * 消息内容
     */
    private String msg;

    /**
     * 消息内容的Base64
     */
    private String msgbase64;

    /**
     * 消息的唯一标识
     */
    private String msgid;

    /**
     * 消息类型的字符串表示
     */
    private String msgtypestr;

    @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;
        }
        WxMessageDataForChat other = (WxMessageDataForChat) that;
        return (this.getTimestamp() == null ? other.getTimestamp() == null : this.getTimestamp().equals(other.getTimestamp()))
            && (this.getFromtype() == null ? other.getFromtype() == null : this.getFromtype().equals(other.getFromtype()))
            && (this.getMsgtype() == null ? other.getMsgtype() == null : this.getMsgtype().equals(other.getMsgtype()))
            && (this.getMsgsource() == null ? other.getMsgsource() == null : this.getMsgsource().equals(other.getMsgsource()))
            && (this.getFromwxid() == null ? other.getFromwxid() == null : this.getFromwxid().equals(other.getFromwxid()))
            && (this.getFinalfromwxid() == null ? other.getFinalfromwxid() == null : this.getFinalfromwxid().equals(other.getFinalfromwxid()))
            && (this.getAtwxidlist() == null ? other.getAtwxidlist() == null : this.getAtwxidlist().equals(other.getAtwxidlist()))
            && (this.getSilence() == null ? other.getSilence() == null : this.getSilence().equals(other.getSilence()))
            && (this.getMembercount() == null ? other.getMembercount() == null : this.getMembercount().equals(other.getMembercount()))
            && (this.getSignature() == null ? other.getSignature() == null : this.getSignature().equals(other.getSignature()))
            && (this.getMsg() == null ? other.getMsg() == null : this.getMsg().equals(other.getMsg()))
            && (this.getMsgbase64() == null ? other.getMsgbase64() == null : this.getMsgbase64().equals(other.getMsgbase64()))
            && (this.getMsgid() == null ? other.getMsgid() == null : this.getMsgid().equals(other.getMsgid()))
            && (this.getMsgtypestr() == null ? other.getMsgtypestr() == null : this.getMsgtypestr().equals(other.getMsgtypestr()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode());
        result = prime * result + ((getFromtype() == null) ? 0 : getFromtype().hashCode());
        result = prime * result + ((getMsgtype() == null) ? 0 : getMsgtype().hashCode());
        result = prime * result + ((getMsgsource() == null) ? 0 : getMsgsource().hashCode());
        result = prime * result + ((getFromwxid() == null) ? 0 : getFromwxid().hashCode());
        result = prime * result + ((getFinalfromwxid() == null) ? 0 : getFinalfromwxid().hashCode());
        result = prime * result + ((getAtwxidlist() == null) ? 0 : getAtwxidlist().hashCode());
        result = prime * result + ((getSilence() == null) ? 0 : getSilence().hashCode());
        result = prime * result + ((getMembercount() == null) ? 0 : getMembercount().hashCode());
        result = prime * result + ((getSignature() == null) ? 0 : getSignature().hashCode());
        result = prime * result + ((getMsg() == null) ? 0 : getMsg().hashCode());
        result = prime * result + ((getMsgbase64() == null) ? 0 : getMsgbase64().hashCode());
        result = prime * result + ((getMsgid() == null) ? 0 : getMsgid().hashCode());
        result = prime * result + ((getMsgtypestr() == null) ? 0 : getMsgtypestr().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", timestamp=").append(timestamp);
        sb.append(", fromtype=").append(fromtype);
        sb.append(", msgtype=").append(msgtype);
        sb.append(", msgsource=").append(msgsource);
        sb.append(", fromwxid=").append(fromwxid);
        sb.append(", finalfromwxid=").append(finalfromwxid);
        sb.append(", atwxidlist=").append(atwxidlist);
        sb.append(", silence=").append(silence);
        sb.append(", membercount=").append(membercount);
        sb.append(", signature=").append(signature);
        sb.append(", msg=").append(msg);
        sb.append(", msgbase64=").append(msgbase64);
        sb.append(", msgid=").append(msgid);
        sb.append(", msgtypestr=").append(msgtypestr);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
