package com.duiba.tuia.youtui.web.embed;

import com.alibaba.fastjson.JSONObject;
import com.duiba.tuia.youtui.web.constant.Constants;
import com.duiba.tuia.youtui.web.tool.DomainConstantUtil;

/**
 * Created by zhou_wb on 2017/11/1.
 */
public class PluginEmbed {

    private PluginEmbed() {
    }

    public static  String stPluginBtnMoreClick(Long appId, Long consumerId, Long activityId, Long pluginId, String host, Integer pageType){
        String dpm = DpmBuilder.pluginBuild(appId);
        String dcm = DcmBuilder.pluginBuild(pluginId,activityId,pageType);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("domain4Web", "//" + host);
        jsonObject.put("url", Constants.PATH.STATISTICS + Constants.PATH.CLICK);
        jsonObject.put("dpm",dpm);
        jsonObject.put("dcm",dcm);
        jsonObject.put("consumerId",consumerId);
        jsonObject.put("appId",appId);
        return  jsonObject.toJSONString();
    }

    public static String stPluginBtnMoreExposure(Long appId, Long consumerId, Long activityId, Long pluginId, Integer pageType) {
        String dpm = DpmBuilder.pluginBuild(appId);
        String dcm = DcmBuilder.pluginBuild(pluginId, activityId, pageType);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("domain", DomainConstantUtil.getAppEmbedClickUrl());//埋点服务器Domain
        jsonObject.put("dpm", dpm);
        jsonObject.put("dcm", dcm);
        jsonObject.put("consumerId", consumerId);
        jsonObject.put("appId", appId);
        return jsonObject.toJSONString();
    }
}
