package com.ydl.ydlcommon.utils;

import android.content.Context;
import android.util.Log;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.umeng.analytics.MobclickAgent;
import com.umeng.analytics.dplus.UMADplus;
import com.ydl.ydl_router.provider.YDLRouterBurryPointProvider;
import com.yidianling.common.tools.LogUtil;

import java.util.HashMap;

/**
 * Created by Wi1ls on 2016/11/11;
 */
@Route(path = "/burry/point")
public class UMEventUtils implements YDLRouterBurryPointProvider{
    public static final String test = "aaa";
    //登录注册首页_登录注册确认点击
    public static final String POINT_LOGIN_CLINK_NEXT = "RegisterAndLoginActivity|click_next";
    //登录注册首页_微信登录点击
    public static final String POINT_CLICK_WECHAT     = "RegisterAndLoginActivity|click_wechat";
    //登录注册首页_QQ登录点击
    public static final String POINT_CLICK_QQ         = "RegisterAndLoginActivity|click_QQ";
    //密码登录_下一步点击
    public static final String POINT_CLICK_NEXT       = "InputPassWordActivity|click_next";
    //密码登录_切换短信登录
    public static final String POINT_CLICK_SMS        = "InputPassWordActivity|click_sms";
    //密码登录_忘记密码
    public static final String POINT_CLICK_FORGET     = "InputPassWordActivity|click_forget";
    //密码登录_密码可见切换
    public static final String POINT_CLICK_VISIBLE    = "InputPassWordActivity|click_visible";
    //短信登录1_切换密码登录
    public static final String POINT_CLICK_PWD        = "VerificationCodeActivity|click_pwd";
    //短信登录1_重发短信
    public static final String POINT_CLICK_RESEND     = "VerificationCodeActivity|click_resend";
    //短信登录1_验证码输入
    public static final String POINT_INPUT_CODE       = "PhoneCode|input_code";
    //短信登录1_验证码校验
    public static final String POINT_VERIFY_CODE      = "VerificationCodeActivity|verify_code";

    private static final String UMEventUtilsTAG = "UMEventUtils-clickEvent";

    public static final String NEW_HOME_MODULE_KEY = "home|";

    //搜索
    public static void um_search(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_search");
    }

    //广告
    public static void um_ad(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_ad");
    }


    //电话倾诉
    public static void um_listenerlist(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_listenerlist");
    }

    //说心事列表
    public static void um_asklist(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_asklist");
    }

    //专家推荐
    public static void um_experrecommend(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_experrecommend");
    }

    //fm详情
    public static void um_fmdetail(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_fmdetail");
    }

    //文章详情
    public static void um_articledetail(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_articledetail");
    }

    public static void te(){
        YdlBuryPointUtil.sendClick("home|click_wenzhang");
    }

    //专家列表
    public static void um_expertlist(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_expertlist");
    }

    //专家主页
    public static void um_expertdetail(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_expertdetail");
    }

    //私聊
    public static void um_chat(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_chat");
    }

    //小壹
    public static void um_chat_xiaoyi(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_chat_xiaoyi");
    }

    //壹点灵
    public static void um_chat_ydl(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_chat_ydl");
    }

    //消息列表
    public static void um_msg(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_msg");
    }

    //预约页
    public static void um_order(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_order");
    }

    //预约付款页
    public static void um_pay(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_pay");
    }

    //付款成功页
    public static void um_pay_success(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_pay_success");
    }

    //聆听者详情页
    public static void um_listendetail(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_listendetail");
    }

    //倾诉页
    public static void um_listening(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_listening");
    }

    //登录页
    public static void um_login(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_login");
    }

    //充值页
    public static void um_recharge(Context mContext) {
        MobclickAgent.onEvent(mContext, "um_recharge");
    }

    //消息列表设置手势提醒点击
    public static void msgListPrivacyAlert(Context context) {
        MobclickAgent.onEvent(context, "msglist_privacy_alert");
    }

    //消息列表设置手势提醒关闭
    public static void msgListPrivacyClose(Context context) {
        MobclickAgent.onEvent(context, "msglist_privacy_close");
    }

    //动态列表设置手势提醒点击
    public static void askListPrivacyAlert(Context context) {
        MobclickAgent.onEvent(context, "asklist_privacy_alert");
    }

    //动态列表设置手势提醒关闭
    public static void askListPrivacyClose(Context context) {
        MobclickAgent.onEvent(context, "asklist_privacy_close");
    }

    //订单列表设置手势提醒点击
    public static void orderListPrivacyAlert(Context context) {
        MobclickAgent.onEvent(context, "orderlist_privacy_alert");
    }

    //订单列表设置手势提醒关闭
    public static void orderListPrivacyClose(Context context) {
        MobclickAgent.onEvent(context, "orderklist_privacy_close");
    }

    //倾诉列表（PV/UV/连接）
    public static void listen_list(Context context) {
        MobclickAgent.onEvent(context, "listen_list");
    }

    //倾诉首页banner（PV/UV）
    public static void listen_banner(Context context) {
        MobclickAgent.onEvent(context, "banner");
    }

    //倾诉首页分类（PV/UV）
    public static void listen_classification(Context context) {
        MobclickAgent.onEvent(context, "classification");
    }

    //倾诉首页连接（放弃/充值/成功）
    public static void listen_connect(Context context) {
        MobclickAgent.onEvent(context, "Connect");
    }

    //为你推荐-再换一个（PV/UV）
    public static void listen_recommend_change(Context context) {
        MobclickAgent.onEvent(context, "Recommend_change");
    }

    //为你推荐-向TA倾诉（PV/UV/付费）
    public static void listen_recommend_say(Context context) {
        MobclickAgent.onEvent(context, "Recommend_say");
    }

    //为你推荐-更多（PV/UV）
    public static void listen_recommend_more(Context context) {
        MobclickAgent.onEvent(context, "Recommend_more");
    }

    //为你推荐-播放（PV/UV）
    public static void listen_recommend_play(Context context) {
        MobclickAgent.onEvent(context, "Recommend_play");
    }

    //听声寻人-向TA倾诉（PV/UV/付费）
    public static void listen_find_say(Context context) {
        MobclickAgent.onEvent(context, "Listen_find_say");
    }

    //听声寻人-更多（PV/UV）
    public static void listen_find_more(Context context) {
        MobclickAgent.onEvent(context, "Listen_find_more");
    }

    //听声寻人-播放（PV/UV）
    public static void listen_find_play(Context context) {
        MobclickAgent.onEvent(context, "Listen_find_play");
    }

    //底部分类（PV/UV）
    public static void listen_recommend(Context context) {
        MobclickAgent.onEvent(context, "Listen_Recommend");
    }

    //音频播放（PV/UV/平均时长）
    public static void listen_audio_frequency(Context context) {
        MobclickAgent.onEvent(context, "audio_frequency");
    }

    //音频列表（PV/UV）
    public static void listen_audio_list(Context context) {
        MobclickAgent.onEvent(context, "audio_list");
    }

    public static void login(Context context, String des) {
        UMADplus.track(context,des,new HashMap<>());
        MobclickAgent.onEvent(context, des);
    }

    /**
     * 点击微信
     * @param className
     */
    public static void clickWechat(String className){
        YdlBuryPointUtil.sendClick(className + "|click_wechat");
    }

    /**
     * 点击QQ
     * @param className
     */
    public static void clickQQ(String className){
        YdlBuryPointUtil.sendClick(className + "|click_QQ");
    }

    /**
     * 微信登录成功
     * @param className
     */
    public static void loginSuccWechat(String className){
        YdlBuryPointUtil.sendClick(className + "|Login_succ_byWechat");
        YdlBuryPointUtil.reLogin();
    }

    /**
     * 注册微信成功
     * @param className
     */
    public static void regSuccByWechat(String className){
        YdlBuryPointUtil.sendClick(className + "|Reg_succ_byWechat");
        YdlBuryPointUtil.reLogin();
    }

    /**
     * qq登录成功
     * @param className
     */
    public static void loginSuccQQ(String className){
        YdlBuryPointUtil.sendClick(className + "|Login_succ_byQQ");
        YdlBuryPointUtil.reLogin();
    }

    /**
     * 注册QQ成功
     * @param className
     */
    public static void regSuccByQQ(String className){
        YdlBuryPointUtil.sendClick(className + "|Reg_succ_byQQ");
        YdlBuryPointUtil.reLogin();
    }

    /**
     * （第三方登录后）手机绑定成功
     * @param className
     */
    public static void bindPhoneByThird(String className){
        YdlBuryPointUtil.sendClick(className + "|Bind_succ_byPhone");
    }

    //壹点零用户版-首页热门话题-更多按钮 add by xujian 20181224
    public static void click_more(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_more");
    }

    //壹点零用户版-编辑页-发布按钮点击 add by xujian 20181224
    public static void click_publish(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_publish");
    }

    //壹点零用户版-编辑页-返回按钮点击 add by xujian 20181224
    public static void click_return(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_return");
    }

    //壹点零用户版-选择话题页面-取消按钮点击 add by xujian 20181224
    public static void click_cancel(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_cancel");
    }

    //壹点零用户版-选择话题页面-话题选择点击 add by xujian 20181224
    public static void click_topic(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_topic");
    }

    //壹点零用户版-测试详情页面-测试详情页面计数 add by xujian 20181224
    public static void click_subject(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_subject");
    }

    //壹点零用户版-测试详情页面-点击立即测试 add by xujian 20181224
    public static void click_start(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_start");
    }

    //壹点零用户版-测试结果页面-点击重新测试 add by xujian 20181224
    public static void click_retest(String className) {
        YdlBuryPointUtil.sendClick(className + "|click_retest");
    }

    //壹点零用户版-首页心理测试按钮 add by xujian 20190109
    public static void click_test(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_test");
    }

    //壹点零用户版-测评频道页-搜索栏点击 add by xujian 20190109
    public static void click_search(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_search");
    }

    //壹点零用户版-测评频道页-banner页点击 add by xujian 20190109
    public static void click_banner(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_banner");
    }

    //壹点零用户版-测评频道页-热门推荐题点击 add by xujian 20190109
    public static void click_recommend(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_recommend");
    }

    //壹点零用户版-测评频道页-热门推荐题点击 add by xujian 20190109
    public static void click_personal(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_personal");
    }

    //壹点零用户版-测评列表页_类目点击 add by xujian 20190109
    public static void click_category(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_category");
    }

    //壹点零用户版-我的课程-和他私聊点击 add by xujian 20190109
    public static void click_chat(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_chat");
    }

    //壹点零用户版-我的课程-和他倾诉点击 add by xujian 20190109
    public static void click_audient(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_audient");
    }

    //壹点零用户版-我的课程-和他咨询点击 add by xujian 20190109
    public static void click_consult(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_consult");
    }

    //壹点零用户版-fm播放点击 add by xujian 20190109
    public static void click_play(String className) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|click_play");
    }

    //壹点零用户版-测评频道页_付费类目点击 add by xujian 20190109
    public static void click_category_btn(String className, String clickName) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|" + clickName);
    }

    //壹点零用户版-H5页面埋点通用方法 add by xujian 20190109
    public static void click_common_h5(String className, String clickName) {
        LogUtil.i(UMEventUtilsTAG, className);
        YdlBuryPointUtil.sendClick(className + "|" + clickName);
    }

    //首页改版 - Banner点击
    public static void click_banner() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_banner");
    }

    //首页改版 - 测试题目点击
    public static void click_ceshi() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ceshi");
    }

    //首页改版 - 更多测试点击
    public static void click_ceshimore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ceshimore");
    }

    //首页改版 - 倾述专家点击
    public static void click_qingsu() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_qingsu");
    }

    //首页改版 - 更多专家点击
    public static void click_qingsumore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_qingsumore");
    }


    //首页改版 - 主页底部导航栏选择课程tab
    public static void click_main_tab_kecheng() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_main_tab_kecheng");
    }

    //首页改版 - 顶部心理课堂模块点击
    public static void click_top_kecheng_tab() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_top_kecheng_tab");
    }

    //首页改版 - 课程点击
    public static void click_kecheng() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_kecheng");
    }

    //首页改版 - 更多课程点击
    public static void click_kechengmore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_kechengmore");
    }

    //首页改版 - 问答点击
    public static void click_dongtai() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_dongtai");
    }

    //首页改版 - 更多问答点击
    public static void click_dongtaimore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_dongtaimore");
    }

    //首页改版 - 编辑入口点击
    public static void click_ask() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_ask");
    }

    //首页改版 - fm详情点击
    public static void click_fm() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_fm");
    }

    //首页改版 - 更多fm点击
    public static void click_fmmore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_fmmore");
    }

    //首页改版 - 文章详情点击
    public static void click_wenzhang() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_wenzhang");
    }

    //首页改版 - 更多文章点击
    public static void click_wenzhangmore() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_wenzhangmore");
    }

    //咨询频道页 - Banner图点击
    public static void click_zixun_banner() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "zixunbanner");
    }

    //咨询频道页 - 免费测试点击
    public static void click_zixun_free() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_free");
    }

    //咨询频道页 - 咨询指南点击
    public static void click_zixun_zhinan() {
        YdlBuryPointUtil.sendClick(NEW_HOME_MODULE_KEY + "click_zhinan");
    }



    /**
     * 登录成功
     *
     * @param eventName
     */
    public static void loginSuccess(String eventName) {
        Log.e("http","-----------loginSuccess="+eventName);
//        umJavaEvent(eventName);
        YdlBuryPointUtil.sendClick(eventName);
        YdlBuryPointUtil.reLogin();
    }

    /**
     * 所有点击时间的埋点
     * 除事件名外，其余两个参数可以为空
     *
     * @param eventName     事件名
     * @param propertyName  属性名
     * @param propertyValue 属性值
     */
//    @PointTrace()
    public static void umEvent(String eventName, String propertyName, String propertyValue) {
    }

    /**
     * 基于java长链接的埋点
     *
     * @param eventName 事件名
     */
//    @CustomPointTrace()
    public static void umJavaEvent(String eventName) {
        Log.e("http","-------------"+eventName);
    }

    @Override
    public void burryPoint(String s, String s1) {
        click_common_h5(s,s1);
    }

    @Override
    public void init(Context context) {

    }
}
