package cn.com.ctop.crawler.modules.kuaishoucce.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;

/**
 * 快手创意视频
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2020-03-03
 */
@Data
@TableName("kuaishou_inspired_ad")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "kuaishou_inspired_ad对象", description = "快手创意视频")
public class KuaishouInspiredAd {

    /**
     * id
     */
    @TableId
    @ApiModelProperty(value = "id")
    private Long id;
    /**
     * mainMvUrl
     */
    @Excel(name = "mainMvUrl", width = 15)
    @ApiModelProperty(value = "mainMvUrl")
    private String mainMvUrl;
    /**
     * coverThumbnailUrl
     */
    @Excel(name = "coverThumbnailUrl", width = 15)
    @ApiModelProperty(value = "coverThumbnailUrl")
    private String coverThumbnailUrl;
    /**
     * width
     */
    @Excel(name = "width", width = 15)
    @ApiModelProperty(value = "width")
    private Integer width;
    /**
     * height
     */
    @Excel(name = "height", width = 15)
    @ApiModelProperty(value = "height")
    private Integer height;
    /**
     * videoDuration
     */
    @Excel(name = "videoDuration", width = 15)
    @ApiModelProperty(value = "videoDuration")
    private Long videoDuration;
    /**
     * headUrl
     */
    @Excel(name = "headUrl", width = 15)
    @ApiModelProperty(value = "headUrl")
    private String headUrl;
    /**
     * firstIndustryName
     */
    @Excel(name = "firstIndustryName", width = 15)
    @ApiModelProperty(value = "firstIndustryName")
    private String firstIndustryName;
    /**
     * nickName
     */
    @Excel(name = "nickName", width = 15)
    @ApiModelProperty(value = "nickName")
    private String nickName;
    /**
     * caption
     */
    @Excel(name = "caption", width = 15)
    @ApiModelProperty(value = "caption")
    private String caption;
    /**
     * createTime
     */
    @ApiModelProperty(value = "createTime")
    private Date createTime;
    /**
     * updateTime
     */
    @ApiModelProperty(value = "updateTime")
    private Date updateTime;

    public KuaishouInspiredAd() {
    }

    public KuaishouInspiredAd(JSONObject data) {
        this.id = data.getLong("photoId");
        this.mainMvUrl = data.getJSONArray("mainMvUrls").getJSONObject(0).getString("url");
        this.coverThumbnailUrl = data.getJSONArray("coverThumbnailUrls").getJSONObject(0).getString("url");
        ;
        this.width = data.getInteger("width");
        this.height = data.getInteger("height");
        this.videoDuration = data.getLong("videoDuration");
        this.headUrl = data.getJSONArray("headUrls").getJSONObject(0).getString("url");
        ;
        ;
        this.firstIndustryName = data.getString("firstIndustryName");
        this.nickName = data.getString("nickName");
        this.caption = data.getString("caption");
        this.createTime = new Date();
        this.updateTime = new Date();
    }
}
