package com.sheep.gamegroup.model.entity;

import android.text.TextUtils;

import com.sheep.gamegroup.absBase.IJumpWeb;
import com.sheep.gamegroup.absBase.ITag;

/**
 * 首页list
 * <p>
 * Created by ljy on 2018/5/10.
 * Display:	integer ($int64)
 * 是否显示
 * JsUrl:	string
 * js注入的js地址，当类型为内部h5时，选填
 * CreateTime:	integer ($int64)
 * 创建时间，时间戳
 * Jump:	string
 * 跳转（h5填跳转地址，原生：1试玩赚钱，2邀请赚钱，3躺着赚钱，4办卡赚钱）
 * Order:	integer ($int64)
 * 排序，默认99，越小越靠前
 * Url:	string
 * url
 * Desc:	string
 * 描述
 * Platform:	integer ($int64)
 * 平台 0全部 1 andriod 2 ios
 * UpdateTime:	integer ($int64)
 * 更新时间
 * Title:	string
 * 标题
 * Icon:	string
 * 图标地址
 * Type:	integer ($int64)
 * 类型（0不跳转，1h5，2原生, 3特殊）
 * Tag:	integer ($int64)
 * 标签类型（0无，1热门，2最新，3现金，4活跃，5福利，6红包）
 * Id:	integer ($int64)
 * IsNeedJsInteract:	integer ($int64)
 * 是否需要js交互，类型为内部h5时，选填 1:需要 2:不需要
 */

public class HomeListEntity implements ITag, IJumpWeb {
    private String CreateTime;//	integer ($int64)创建时间，时间戳
    private String Desc;//	string描述
    private String Icon;//	string图标地址
    private int Id;//	integer ($int64)
    private String Jump;//	string跳转（h5填跳转地址，原生：1试玩赚钱，2邀请赚钱，3躺着赚钱，4办卡赚钱）-1新手任务
    private String Order;//	integer ($int64)排序，默认99，越小越靠前
    private String Title;//	string标题
    private int Type;//	integer ($int64)类型（0不跳转，1h5，2原生）
    private int IsNew;//	int	  `orm:"column(is_new);null" description:"是否是最新标签 0:不是 1:是"`
    private int IsHot;//	   int	  `orm:"column(is_hot);null" description:"是否是热门标签 0:不是 1:是"`
    private String UpdateTime;//	integer ($int64)更新时间
    private String Url;//	integer ($int64)更新时间
    private boolean select;
    private int Tag;//标签类型（0无，1热门，2最新，3现金，4活跃，5福利）
    private String JsUrl;
    private int IsNeedJsInteract;

    public int getTag() {
        return Tag;
    }

    public void setTag(int tag) {
        Tag = tag;
    }

    public boolean isSelect() {
        return select;
    }

    public void setSelect(boolean select) {
        this.select = select;
    }

    public String getUrl() {
        return Url;
    }

    public void setUrl(String Url) {
        this.Url = Url;
    }


    public String getCreateTime() {
        return CreateTime;
    }

    public void setCreateTime(String createTime) {
        CreateTime = createTime;
    }

    public String getDesc() {
        return Desc;
    }

    public void setDesc(String desc) {
        Desc = desc;
    }

    public String getIcon() {
        return TextUtils.isEmpty(Icon) ? "0" : Icon;
    }

    public void setIcon(String icon) {
        Icon = icon;
    }

    public int getId() {
        return Id;
    }

    public void setId(int id) {
        Id = id;
    }

    public String getJump() {
        return Jump;
    }

    public void setJump(String jump) {
        Jump = jump;
    }

    public String getOrder() {
        return Order;
    }

    public void setOrder(String order) {
        Order = order;
    }

    public String getTitle() {
        return Title;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public String getUpdateTime() {
        return UpdateTime;
    }

    public void setUpdateTime(String updateTime) {
        UpdateTime = updateTime;
    }

    public int getIsNew() {
        return IsNew;
    }

    public void setIsNew(int isNew) {
        IsNew = isNew;
    }

    public int getIsHot() {
        return IsHot;
    }

    public void setIsHot(int isHot) {
        IsHot = isHot;
    }

    public String getJsUrl() {
        return JsUrl;
    }

    public void setJsUrl(String jsUrl) {
        JsUrl = jsUrl;
    }

    public int getIsNeedJsInteract() {
        return IsNeedJsInteract;
    }

    public void setIsNeedJsInteract(int isNeedJsInteract) {
        IsNeedJsInteract = isNeedJsInteract;
    }

    private boolean isNew() {
        return IsNew == 1;
    }

    private boolean isHot() {
        return IsHot == 1;
    }

    public String getTip() {
        if (isHot()) {
            return "hot";
        }
        if (isNew()) {
            return "new";
        }
        return "";
    }

    public boolean hasTip() {
        return isHot() || isNew();
    }

    public int getTipColor() {
        if (isHot()) {
            return 0xffff0000;
        }
        if (isNew()) {
            return 0xff00ff00;
        }
        return 0x00ffffff;
    }

    @Override
    public boolean needJsInteract() {
        return IsNeedJsInteract == IJumpWeb.NEEDJSINTERACT;
    }
}
