package cn.com.ctop.kuaishou.modules.ai.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * 计划创建记录
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2021-04-12
 */
@Data
@TableName("ctop_ai_kuaishou_campaign_level_operation_record")
public class AiKuaishouCampaignLevelOperationRecord {

    /**
     * 计划操作表uuid
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String campaignUuid;
    /**
     * AI策略ID
     */
    private String aiStrategyUuid;
    /**
     * 账户ID
     */
    private Long accountId;
    /**
     * 广告计划ID
     */
    private Long campaignId;
    /**
     * 广告计划名称
     */
    private String campaignName;
    /**
     * 计划类型 2-提升应用安装 3-获取电商下单 4-推广品牌活动 5-收集销售线索 7-提高应用活跃
     */
    private Integer campaignType;
    /**
     * 单日预算
     */
    private Long dayBudget;
    /**
     * 分日预算
     */
    private String dayBudgetSchedule;
    /**
     * 操作类型 1-新增 2-修改
     */
    private Integer operationType;
    /**
     * 计划创建时间
     */
    private Date campaignCreateTime;
    /**
     * 计划更新时间
     */
    private Date campaignUpdateTime;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 状态
     */
    private Integer status;
    /**
     * 状态详情
     */
    private String message;
    /**
     * 1：账户自动投放 2：项目自动投放
     */
    private Integer createType;

    public AiKuaishouCampaignLevelOperationRecord(AiKuaishouAdvertiserStrategy strategy, Long campaignId, Integer code, String message) {
        this.accountId = strategy.getAccountId();
        this.dayBudget = strategy.getCampaignDayBudget();
        this.dayBudgetSchedule = strategy.getCampaignDayBudgetSchedule();
        this.campaignType = strategy.getCampaignType();
        this.campaignId = campaignId;
        this.status = code;
        this.message = message;
        this.operationType = 1;
        this.createTime = new Date();
    }

    public AiKuaishouCampaignLevelOperationRecord(KuaishouProjectStrategy strategy, Long campaignId, Integer code, String message) {
        this.accountId = strategy.getAccountId();
        this.dayBudget = strategy.getCampaignDayBudget();
        this.campaignType = strategy.getCampaignType();
        this.campaignId = campaignId;
        this.status = code;
        this.message = message;
        this.operationType = 1;
        this.createTime = new Date();
    }
}
