package cn.com.ctop.toutiao.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.com.ctop.common.module.entity.CtopOauthToken;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.util.Date;

/**
 * @Description: 人群包信息
 * @Author: jeecg-boot
 * @Date: 2019-07-23
 * @Version: V1.0
 */
@Data
@TableName("ctop_bytedance_custom_audience")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_bytedance_custom_audience对象", description = "人群包信息")
public class ByteDanceCustomAudience {

    /**
     * id
     */
    @TableId
    @ApiModelProperty(value = "id")
    private Long id;
    /**
     * 广告主id
     */
    @Excel(name = "广告主id", width = 15)
    @ApiModelProperty(value = "广告主id")
    private String advertiserId;
    /**
     * 头条账号id
     */
    @Excel(name = "头条账号id", width = 15)
    @ApiModelProperty(value = "头条账号id")
    private Long accountId;
    /**
     * 是否删除
     */
    @Excel(name = "是否删除", width = 15)
    @ApiModelProperty(value = "是否删除")
    private Integer isdel;
    /**
     * 数据源id
     */
    @Excel(name = "数据源id", width = 15)
    @ApiModelProperty(value = "数据源id")
    private String dataSourceId;
    /**
     * 人群包名称
     */
    @Excel(name = "人群包名称", width = 15)
    @ApiModelProperty(value = "人群包名称")
    private String name;
    /**
     * 人群包来源
     */
    @Excel(name = "人群包来源", width = 15)
    @ApiModelProperty(value = "人群包来源")
    private String source;
    /**
     * 人群包状态
     */
    @Excel(name = "人群包状态", width = 15)
    @ApiModelProperty(value = "人群包状态")
    private Integer status;
    /**
     * 人群包覆盖人群数目
     */
    @Excel(name = "人群包覆盖人群数目", width = 15)
    @ApiModelProperty(value = "人群包覆盖人群数目")
    private Long coverNum;
    /**
     * 上传类型人群包包含人群数目
     */
    @Excel(name = "上传类型人群包包含人群数目", width = 15)
    @ApiModelProperty(value = "上传类型人群包包含人群数目")
    private Long uploadNum;
    /**
     * 人群分组
     */
    @Excel(name = "人群分组", width = 15)
    @ApiModelProperty(value = "人群分组")
    private String tag;
    /**
     * createTime
     */
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**
     * updateTime
     */
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;

    public ByteDanceCustomAudience() {
    }

    public ByteDanceCustomAudience(CtopOauthToken token, JSONObject dataObject) {
        this.id = dataObject.getLong("custom_audience_id");
        this.accountId = token.getAccountId();
        this.advertiserId = token.getAdvertiserId();
        this.isdel = dataObject.getInteger("isdel");
        this.dataSourceId = dataObject.getString("custom_audience_id");
        this.name = dataObject.getString("name");
        this.source = dataObject.getString("source");
        this.status = dataObject.getInteger("status");
        this.coverNum = dataObject.getLong("cover_num");
        this.uploadNum = dataObject.getLong("upload_num");
        this.tag = dataObject.getString("tag");
    }
}
