package com.xxl.job.executor.report.entity;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxl.job.executor.utils.DateUtils;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 头条视频素材日报表--仅包含视频素材
 * @author sunzhen
 */
@Data
@TableName("ctop_bytedance_report_video_material_daily")
public class BytedanceReportVideoMaterialDaily {

	/**id*/
	@TableId(type = IdType.AUTO)

	private Long id;
	/**账户id*/
	private Long accountId;
	/**数据起始时间1*/

	private String statDatetime;
	/**素材id*/
	private Long materialId;
	/**展现数据-点击数*/

	private Long click;
	/**展现数据-总花费*/

	private BigDecimal cost;
	/**展现数据-总花费*/

	private BigDecimal avgClickCost;
	/**转化数据-深度转化数*/

	private Long deepConvert;
	/**转化数据-深度转化成本*/

	private BigDecimal deepConvertCost;
	/**转化数据-深度转化率*/

	private BigDecimal deepConvertRate;
	/**互动数据-不感兴趣数*/

	private Long dislike;
	/**互动数据-举报数*/

	private Long report;
	/**视频数据-2秒播放率*/

	private BigDecimal playDuration2sRate;
	/**视频数据-3秒播放率*/

	private BigDecimal playDuration3sRate;
	/**视频数据-5秒播放率*/

	private BigDecimal playDuration5sRate;
	/**视频数据-10秒播放率*/

	private BigDecimal playDuration10sRate;
	/**视频数据-25%进度播放率*/

	private BigDecimal play25FeedBreakRate;
	/**视频数据-50%进度播放率*/

	private BigDecimal play50FeedBreakRate;
	/**视频数据-75%进度播放率*/

	private BigDecimal play75FeedBreakRate;
	/**视频数据-99%进度播放率*/

	private BigDecimal play100FeedBreakRate;
	/**展现数据-平均千次展现费用*/

	private BigDecimal avgShowCost;
	/**视频数据-播放数*/

	private Long totalPlay;
	/**视频数据-有效播放数*/

	private Long validPlay;
	/**互动数据-分享数*/

	private Long shareMaterial;
	/**互动数据-评论数*/

	private Long commentMaterial;
	/**互动数据-新增关注数*/

	private Long follow;
	/**视频数据-有效播放成本*/

	private BigDecimal validPlayCost;
	/**转化数据-转化数*/

	private Long convertMaterial;
	/**视频数据-播完率*/

	private BigDecimal playOverRate;
	/**展现数据-点击率*/

	private BigDecimal ctr;
	/**互动数据-点赞数*/

	private Long likeMaterial;
	/**展现数据-展示数*/

	private Long showMaterial;
	/**转化数据-转化率*/

	private BigDecimal convertRate;
	/**视频数据-播放完成数*/

	private Long playOver;
	/**互动数据-私信数*/

	private Long messageAction;
	/**视频数据-有效播放率*/

	private BigDecimal validPlayRate;
	/**视频数据-平均单次播放时长*/

	private BigDecimal averagePlayTimePerPlay;
	/**转化数据-转化成本*/

	private BigDecimal convertCost;
	/***/

	private BigDecimal convertShowRate;

	public BytedanceReportVideoMaterialDaily() {
	}

	public BytedanceReportVideoMaterialDaily(JSONObject detailJson, Long accountId) {
		JSONObject dimensions = detailJson.getJSONObject("dimensions");
		this.accountId = accountId;
		this.setMaterialId(dimensions.getLong("material_id"));
		this.setStatDatetime(dimensions.getDate("stat_datetime") == null ? null : DateUtils.formatDate(dimensions.getDate("stat_datetime"), "yyyy-MM-dd"));

		JSONObject metrics = detailJson.getJSONObject("metrics");
		this.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
		this.setClick(metrics.getLong("click"));
		this.setDislike(metrics.getLong("dislike"));
		this.setReport(metrics.getLong("report"));
		this.setCost(metrics.getBigDecimal("cost"));
		this.setAvgClickCost(metrics.getBigDecimal("avg_click_cost"));
		this.setDeepConvert(metrics.getLong("deep_convert"));
		this.setDeepConvertCost(metrics.getBigDecimal("deep_convert_cost"));
		this.setDeepConvertRate(metrics.getBigDecimal("deep_convert_rate"));
		this.setPlayDuration2sRate(metrics.getBigDecimal("play_duration_2s_rate"));
		this.setPlayDuration3sRate(metrics.getBigDecimal("play_duration_3s_rate"));
		this.setPlayDuration5sRate(metrics.getBigDecimal("play_duration_5s_rate"));
		this.setPlayDuration10sRate(metrics.getBigDecimal("play_duration_10s_rate"));
		this.setPlay25FeedBreakRate(metrics.getBigDecimal("play_25_feed_break_rate"));
		this.setPlay50FeedBreakRate(metrics.getBigDecimal("play_50_feed_break_rate"));
		this.setPlay75FeedBreakRate(metrics.getBigDecimal("play_75_feed_break_rate"));
		this.setPlay100FeedBreakRate(metrics.getBigDecimal("play_100_feed_break_rate"));
		this.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
		this.setAvgShowCost(metrics.getBigDecimal("avg_show_cost"));
		this.setTotalPlay(metrics.getLong("total_play"));
		this.setValidPlay(metrics.getLong("valid_play"));
		this.setShareMaterial(metrics.getLong("share"));
		this.setCommentMaterial(metrics.getLong("comment"));
		this.setFollow(metrics.getLong("follow"));
		this.setValidPlayCost(metrics.getBigDecimal("valid_play_cost"));
		this.setConvertMaterial(metrics.getLong("convert"));
		this.setPlayOverRate(metrics.getBigDecimal("play_over_rate"));
		this.setCtr(metrics.getBigDecimal("ctr"));
		this.setLikeMaterial(metrics.getLong("like"));
		this.setShowMaterial(metrics.getLong("show"));
		this.setConvertRate(metrics.getBigDecimal("convert_rate"));
		this.setPlayOver(metrics.getLong("play_over"));
		this.setMessageAction(metrics.getLong("message_action"));
		this.setValidPlayRate(metrics.getBigDecimal("valid_play_rate"));
		this.setAveragePlayTimePerPlay(metrics.getBigDecimal("average_play_time_per_play"));
		this.setConvertCost(metrics.getBigDecimal("convert_cost"));
		this.setConvertShowRate(metrics.getBigDecimal("convert_show_rate"));
	}

}
