package com.tzld.piaoquan.ad.engine.service.predict.param;

import com.alibaba.fastjson.JSONObject;
import com.tzld.piaoquan.ad.engine.commons.param.MachineInfoParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.poi.ss.formula.functions.T;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * mid mid
 * videoId video_id
 * appType  app_id
 * abTestCode  用户对应的ab组--对应java group
 * abExpInfo AB实验组参数--封装后对应ab_exp_info
 * careModelStatus  用户关怀模式状态 1-未开启，2-开启
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ThresholdPredictModelParam {
    String mid;
    Long videoId;
    Integer appType;
    String abTestCode; // drop
    JSONObject abExpInfo; // drop
    Long careModelStatus; // drop
    String abtestId; // drop
    String abTestConfigTag; // drop
    Map<String, Object> abtestParam; // drop
    String midGroup; // drop
    Date date = new Date();

    String region = "-1";
    //市-中文
    String city = "-1";
    MachineInfoParam machineInfo = new MachineInfoParam();

    private String adPlatformType;


    private String userExternalSource;

    /**
     * 分享所属层
     * <br />
     * 1. firstLayer: 首层
     * <br />
     * 2. otherLayer: 裂变层
     */
    private String shareLayer;

    Map<String,Object> extraParam=new HashMap<>();
    Map<String,Object> userExtraFutureMap=new HashMap<>();

    public void addUserExtraFuture(String key,Object val){
        if(userExtraFutureMap!=null){
            userExtraFutureMap.put(key,val);
        }else {
            userExtraFutureMap=new HashMap<>();
            userExtraFutureMap.put(key,val);
        }
    }

    public void addAllIntoUserExtraFuture(Map<String,Object> map){
        if(userExtraFutureMap!=null){
            userExtraFutureMap.putAll(map);
        }else {
            userExtraFutureMap=map;
        }
    }

    public Object getUserExtraFuture(String key){
        if(userExtraFutureMap!=null){
            return userExtraFutureMap.getOrDefault(key,new T());
        }
        return null;
    }
}
