package ctop.bytedance.ad.advertise.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 org.jeecgframework.poi.excel.annotation.Excel;

import java.util.Date;

/**
 * @Description: 今日头条创意素材信息
 * @Author: jeecg-boot
 * @Date: 2019-07-22
 * @Version: V1.0
 */
@Data
@TableName("ctop_bytedance_creative_material")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "ctop_bytedance_creative_material对象", description = "今日头条创意素材信息")
public class ByteDanceCreativeMaterial {

    /**
     * 素材id
     */
    @TableId
    private Long id;
    /**
     * 广告主id
     */
    private Long accountId;
    /**
     * 广告id
     */
    private Long adId;
    /**
     * 创意标题
     */
    private String title;
    /**
     * 创意状态
     */
    private String status;
    /**
     * 创意状态
     */
    private String optStatus;
    /**
     * 创意类型
     */
    private String imageMode;
    /**
     * 图片素材信息
     */
    private String imageInfo;
    /**
     * createTime
     */
    private Date createTime;
    /**
     * updateTime
     */
    private Date updateTime;

    public ByteDanceCreativeMaterial() {
    }

    public ByteDanceCreativeMaterial(JSONObject dataObject, String accountId) {
        this.id = dataObject.getLong("id");
        this.accountId = dataObject.getLong("advertiser_id");

        String status = dataObject.getString("status");
        if (null != status && !"".equals(status.trim())) {
            this.status = status;
        }

        Long adId = dataObject.getLong("ad_id");
        if (null != adId) {
            this.adId = adId;
        }

        String title = dataObject.getString("title");
        if (null != title && !"".equals(title.trim())) {
            this.title = title;
        }

        String imageMode = dataObject.getString("image_mode");
        if (null != imageMode && !"".equals(imageMode.trim())) {
            this.imageMode = imageMode;
        }

        String imageInfo = dataObject.getString("image_info");
        if (null != imageInfo && !"".equals(imageInfo.trim())) {
            this.imageInfo = imageInfo;
        }

        String optStatus = dataObject.getString("opt_status");
        if (null != optStatus && !"".equals(optStatus.trim())) {
            this.optStatus = optStatus;
        }
    }
}
