package com.sheep.gamegroup.model.entity;

import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;

/**
 * created on：2018/9/3 on 13:36
 * created by: YSL
 * 描述:消息中心列表   ,  消息中心详情
 */
public class SystemNotification implements Serializable {


    /**
     * {
     * "Id": 41,
     * "type": 3,
     * "title": "连续任务模块上线",
     * "content": "连续任务模块上线",
     * "abstracts": "连续任务模块上线",
     * "platform": 0,
     * "recipient": 0,
     * "recipient_invitation_code": "",
     * "send_time": 1536742603,
     * "created_at": 1536742605,
     * "updated_at": 1536742605,
     * "send_type": 1,
     * "is_look": 1,
     * "relation_id": 8,
     * "relation_data": {
     * "Id": 8,
     * "Title": "连续任务",
     * "Desc": "连续任务收益多多",
     * "Icon": "http:\/\/img.zcool.cn\/community\/01080755c1edaf32f87528a18e9840.jpg@900w_1l_2o_100sh.jpg",
     * "Type": 2,
     * "Jump": "8",
     * "Order": 8,
     * "CreateTime": 1525957376,
     * "UpdateTime": 1531744035,
     * "Url": "",
     * "Display": 1,
     * "Tag": 0,
     * "Platform": 0
     * }
     * }
     * Id	integer($int64)
     * abstracts	string
     * 摘要
     * <p>
     * content	string
     * 消息内容
     * <p>
     * created_at	integer($int64)
     * 创建时间
     * <p>
     * is_look	integer($int64)
     * 是否已查看 1已查看 0未查看
     * <p>
     * platform	integer($int32)
     * 0:全平台 1:安卓 2:IOS
     * <p>
     * recipient	integer($int32)
     * 0:全部 1:指定人
     * <p>
     * recipient_invitation_code	string
     * 接收人绵羊号多个;隔开，空为全部
     * <p>
     * relation_data	{...}
     * relation_id	integer($int64)
     * 根据type类型关联不同表ID
     * <p>
     * send_time	integer($int64)
     * 推送时间
     * <p>
     * send_type	integer($int32)
     * 推送类型 1:立即推送 2:定时推送
     * <p>
     * title	string
     * 消息标题
     * <p>
     * type	integer($int32)
     *
     * <p>
     * updated_at	integer($int64)
     * 更新时间
     */

    private int updated_at;
    private int is_look;
    private int Id;
    private String content;
    private int platform;
    private String abstracts;
    private String title;
    private int recipient;
    private int send_type;
    private String recipient_invitation_code;
    private int created_at;
    private int send_time;
    private int type;//消息类型 1:通知 2:活动 3:模块上线 4:任务上线 5:任务成功 6:任务失败
    private int relation_id;
    private Object relation_data;

    public int getUpdated_at() {
        return updated_at;
    }

    public void setUpdated_at(int updated_at) {
        this.updated_at = updated_at;
    }

    public int getIs_look() {
        return is_look;
    }

    public void setIs_look(int is_look) {
        this.is_look = is_look;
    }

    public int getId() {
        return Id;
    }

    public void setId(int Id) {
        this.Id = Id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getPlatform() {
        return platform;
    }

    public void setPlatform(int platform) {
        this.platform = platform;
    }

    public String getAbstracts() {
        return abstracts;
    }

    public void setAbstracts(String abstracts) {
        this.abstracts = abstracts;
    }

    public String getTitle() {
        return title;
    }

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

    public int getRecipient() {
        return recipient;
    }

    public void setRecipient(int recipient) {
        this.recipient = recipient;
    }

    public int getSend_type() {
        return send_type;
    }

    public void setSend_type(int send_type) {
        this.send_type = send_type;
    }

    public String getRecipient_invitation_code() {
        return recipient_invitation_code;
    }

    public void setRecipient_invitation_code(String recipient_invitation_code) {
        this.recipient_invitation_code = recipient_invitation_code;
    }

    public int getCreated_at() {
        return created_at;
    }

    public void setCreated_at(int created_at) {
        this.created_at = created_at;
    }

    public int getSend_time() {
        return send_time;
    }

    public void setSend_time(int send_time) {
        this.send_time = send_time;
    }

    public int getType() {
        return type;
    }

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

    public int getRelation_id() {
        return relation_id;
    }

    public void setRelation_id(int relation_id) {
        this.relation_id = relation_id;
    }

    public Object getRelation_data() {
        return relation_data;
    }

    public void setRelation_data(Object relation_data) {
        this.relation_data = relation_data;
    }





    /**
     * 失败返回null
     *
     * @param clazz
     * @param <T>
     * @return
     */
    public <T> T getRelation_data(Class<T> clazz) {
        if (relation_data != null) {
            try {
                return JSONObject.parseObject(JSONObject.toJSONString(relation_data), clazz);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}
