package ink.wgink.module.instantmessage.websocket.pojo;


/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: AppSocketMessage
 * @Description: App Socket 消息
 * @Author: wanggeng
 * @Date: 2021/1/13 11:15 下午
 * @Version: 1.0
 */
public class WebSocketClientMessage {

    /**
     * id
     */
    private String id;
    /**
     * AppSocketTypeEnum 消息类型
     */
    private Integer type;
    /**
     * 是否系统消息
     */
    private Boolean isSystem;
    /**
     * 来源，系统消息为：SYSTEM，非系统消息为 userId
     */
    private String from;
    /**
     * 去处，接收人userId
     */
    private String to;
    /**
     * 消息体
     */
    private String body;
    /**
     * 时间戳
     */
    private long timestamp;

    public WebSocketClientMessage() {
    }

    public WebSocketClientMessage(Integer type, Boolean isSystem, String from, String to, String body) {
        this.type = type;
        this.isSystem = isSystem;
        this.from = from;
        this.to = to;
        this.body = body;
    }

    public String getId() {
        return id == null ? "" : id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Integer getType() {
        return type == null ? 0 : type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Boolean getSystem() {
        return isSystem;
    }

    public void setSystem(Boolean system) {
        isSystem = system;
    }

    public String getFrom() {
        return from == null ? "" : from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to == null ? "" : to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getBody() {
        return body == null ? "" : body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public long getTimestamp() {
        timestamp = System.currentTimeMillis();
        return timestamp;
    }

}
