package com.cm.websocket.pojo;


import com.cm.websocket.enums.SendStatusEnum;

/**
 * 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 AppSocketMessage {

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

    public AppSocketMessage() {
    }

    public AppSocketMessage(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;
    }

    public static class RegisterBody {
        /**
         * AppID
         */
        private String appId;
        /**
         * 用户ID
         */
        private String userId;

        public RegisterBody() {
        }

        public RegisterBody(String appId, String userId) {
            this.appId = appId;
            this.userId = userId;
        }

        public String getAppId() {
            return appId == null ? "" : appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }

        public String getUserId() {
            return userId == null ? "" : userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }
    }

    public static class SendStatusBody {
        private Integer code;
        private SendStatusEnum status;
        private String msg;

        public SendStatusBody() {
        }

        public SendStatusBody(int code, SendStatusEnum status, String msg) {
            this.code = code;
            this.status = status;
            this.msg = msg;
        }

        public Integer getCode() {
            return code == null ? 0 : code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public SendStatusEnum getStatus() {
            return status;
        }

        public void setStatus(SendStatusEnum status) {
            this.status = status;
        }

        public String getMsg() {
            return msg == null ? "" : msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    public static class TargetBody {
        private String msg;
        private String target;

        public TargetBody() {
        }

        public TargetBody(String msg, String target) {
            this.msg = msg;
            this.target = target;
        }

        public String getMsg() {
            return msg == null ? "" : msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public String getTarget() {
            return target == null ? "" : target;
        }

        public void setTarget(String target) {
            this.target = target;
        }
    }

    public static class NoticeBody {
        private String title;
        private String msg;
        private String target;
        private String serviceId;

        public NoticeBody() {
        }

        public NoticeBody(String title, String msg) {
            this.title = title;
            this.msg = msg;
        }

        public NoticeBody(String title, String msg, String target) {
            this.title = title;
            this.msg = msg;
            this.target = target;
        }

        public NoticeBody(String title, String msg, String target, String serviceId) {
            this.title = title;
            this.msg = msg;
            this.target = target;
            this.serviceId = serviceId;
        }

        public String getTitle() {
            return title == null ? "" : title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getMsg() {
            return msg == null ? "" : msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        public String getTarget() {
            return target == null ? "" : target;
        }

        public void setTarget(String target) {
            this.target = target;
        }

        public String getServiceId() {
            return serviceId;
        }

        public void setServiceId(String serviceId) {
            this.serviceId = serviceId;
        }
    }

    public static class CountNeedToDealWithBody {
        private String system;
        private String module;
        private String menu;
        private String serviceId;
        private Integer count;

        public String getSystem() {
            return system == null ? "" : system;
        }

        public void setSystem(String system) {
            this.system = system;
        }

        public String getModule() {
            return module == null ? "" : module;
        }

        public void setModule(String module) {
            this.module = module;
        }

        public String getMenu() {
            return menu == null ? "" : menu;
        }

        public void setMenu(String menu) {
            this.menu = menu;
        }

        public String getServiceId() {
            return serviceId == null ? "" : serviceId;
        }

        public void setServiceId(String serviceId) {
            this.serviceId = serviceId;
        }

        public Integer getCount() {
            return count == null ? 0 : count;
        }

        public void setCount(Integer count) {
            this.count = count;
        }
    }

}
