package com.sheep.gamegroup.model.entity;

import android.text.TextUtils;

import com.lqr.emoji.EmotionLayout;
import com.sheep.gamegroup.absBase.IContentTypeContainer;
import com.sheep.gamegroup.util.StringUtils;

/**
 * Created by realicing on 2018/11/9.
 * realicing@sina.com
 * 新手引导
 * <p>
 * content:	string
 * 内容
 * created_at:	integer ($int64)
 * 创建时间
 * id:	integer ($int64)
 * ID
 * platform:	integer ($int32)
 * 平台（0全平台，1安卓，2苹果）
 * title:	string
 * 标题
 * type:	integer ($int32)
 * 类型（1文字，2视频）
 * updated_at:	integer ($int64)
 * 更新时间
 * video_url:	string
 * 视频地址
 */
public class NoviceGuidance implements IContentTypeContainer<Integer, String> {
    private String content;

    private int created_at;

    private int id;

    private int platform;

    private String title;

    private int type;

    private int updated_at;

    private String video_url;
    private String pre_url;

    private String image_url;

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

    public String getContent(){
        return this.content;
    }
    public void setCreated_at(int created_at){
        this.created_at = created_at;
    }
    public int getCreated_at(){
        return this.created_at;
    }
    public void setId(int id){
        this.id = id;
    }
    public int getId(){
        return this.id;
    }
    public void setPlatform(int platform){
        this.platform = platform;
    }
    public int getPlatform(){
        return this.platform;
    }
    public void setTitle(String title){
        this.title = title;
    }
    public String getTitle(){
        return this.title;
    }
    public void setType(int type){
        this.type = type;
    }
    public int getType(){
        return this.type;
    }
    public void setUpdated_at(int updated_at){
        this.updated_at = updated_at;
    }
    public int getUpdated_at(){
        return this.updated_at;
    }
    public void setVideo_url(String video_url){
        this.video_url = video_url;
    }
    public String getVideo_url(){
        return this.video_url;
    }

    public String getImage_url() {
        return image_url;
    }

    public void setImage_url(String image_url) {
        this.image_url = image_url;
    }

    public String getPre_url() {
        return pre_url;
    }

    public void setPre_url(String pre_url) {
        this.pre_url = pre_url;
    }

    //    //默认类型，服务器数据无此类型，只作为客户端自己直接添加使用，只包含内容
//    public static final int TYPE_MSG = 0;
//    //标题与文本
//    public static final int TYPE_CONTENT = 1;
//    //标题与文本与视频
//    public static final int TYPE_VIDEO = 2;
//    //标题与文本与图片
//    public static final int TYPE_VIDEO = 3;

    //content的类型
    private int contentType;

    public Integer getContentType() {
        return contentType;
    }

    private String contentResult;
    @Override
    public String getContentResult() {
        switch (contentType){
            case StringUtils.CONTENT_TYPE_EXP:
                if(contentResult == null)
                    contentResult = EmotionLayout.changeContent(content);
                return contentResult;
        }
        return content;
    }
}
