package com.sheep.gamegroup.model.entity;

import android.text.TextUtils;

import com.alibaba.fastjson.annotation.JSONField;
import com.sheep.gamegroup.util.ListUtil;

import java.util.List;

/**
 * Created by realicing on 2018/6/27.
 * realicing@sina.com
 *
 */
public class Article {
    private int updated_at;

    private List<ArticleTag> tages ;

    private int recommend_type;//咨询类型1：游戏 2：任务

    private String url;//转跳链接

    private String content;//内容

    private String pictures;//图片 多图用;隔开

    private int platform;//0:全平台 1：安卓 2：IOS

    private int is_display;//是否显示

    private int home_list_id;//首页菜单的ID

    private String title;//标题

    private int id;

    private int is_in_url;//是否外部链接 1：是 0：不是

    private int release_task_id;//发布的任务ID （咨询和任务时）

    @JSONField(name ="abstract")
    private String des;//摘要

    private int created_at;

    private int application_id;//应用ID （咨询和游戏时）

    private String clicks;//点击次数

    private int sort;//排序

    private int type;//类型 1：游戏 2：咨询 3：转跳 4：任务 5：栏目

    private Applications application;

    public void setUpdated_at(int updated_at){
        this.updated_at = updated_at;
    }
    public int getUpdated_at(){
        return this.updated_at;
    }
    public void setTages(List<ArticleTag> tages){
        this.tages = tages;
    }
    public List<ArticleTag> getTages(){
        return this.tages;
    }
    public void setRecommend_type(int recommend_type){
        this.recommend_type = recommend_type;
    }
    public int getRecommend_type(){
        return this.recommend_type;
    }
    public void setUrl(String url){
        this.url = url;
    }
    public String getUrl(){
        return this.url;
    }
    public void setContent(String content){
        this.content = content;
    }
    public String getContent(){
        return this.content;
    }
    public void setPictures(String pictures){
        this.pictures = pictures;
    }
    public String getPictures(){
        return this.pictures;
    }
    public void setPlatform(int platform){
        this.platform = platform;
    }
    public int getPlatform(){
        return this.platform;
    }
    public void setIs_display(int is_display){
        this.is_display = is_display;
    }
    public int getIs_display(){
        return this.is_display;
    }
    public void setHome_list_id(int home_list_id){
        this.home_list_id = home_list_id;
    }
    public int getHome_list_id(){
        return this.home_list_id;
    }
    public void setTitle(String title){
        this.title = title;
    }
    public String getTitle(){
        return this.title;
    }
    public void setId(int id){
        this.id = id;
    }
    public int getId(){
        return this.id;
    }
    public void setIs_in_url(int is_in_url){
        this.is_in_url = is_in_url;
    }
    public int getIs_in_url(){
        return this.is_in_url;
    }
    public void setRelease_task_id(int release_task_id){
        this.release_task_id = release_task_id;
    }
    public int getRelease_task_id(){
        return this.release_task_id;
    }
    public void setDes(String des){
        this.des = des;
    }
    public String getDes(){
        return this.des;
    }
    public void setCreated_at(int created_at){
        this.created_at = created_at;
    }
    public int getCreated_at(){
        return this.created_at;
    }
    public void setApplication_id(int application_id){
        this.application_id = application_id;
    }
    public int getApplication_id(){
        return this.application_id;
    }
    public void setClicks(String clicks){
        this.clicks = clicks;
    }
    public String getClicks(){
        return this.clicks;
    }
    public void setSort(int sort){
        this.sort = sort;
    }
    public int getSort(){
        return this.sort;
    }
    public void setType(int type){
        this.type = type;
    }
    public int getType(){
        return this.type;
    }

    public Applications getApplication() {
        return application;
    }

    public void setApplication(Applications application) {
        this.application = application;
    }


    @Override
    public boolean equals(Object obj) {
        return obj instanceof Article && ((Article) obj).getId() == id;
    }

    //是否是游戏，游戏要显示下载游戏与评分
    public boolean isGame() {
        return type == 1;//类型 1：游戏 2：咨询 3：转跳 4：任务 5：栏目
    }

    //清除空的或者没有名字的标签
    public void removeNullTag() {
        ListUtil.removeItem(tages, new ListUtil.CallBack<ArticleTag, Boolean>(){

            @Override
            public Boolean call(ArticleTag findTag) {
                return findTag == null || TextUtils.isEmpty(findTag.getName());
            }
        });
    }
}
