package com.gem.media;

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

import com.gem.media.splash.base.utils.ALog;
import com.or.ange.dot.Settings;
import com.or.ange.dot.UsageStats;
import com.or.ange.dot.utils.LLog;

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

public class StatsStaticHelper {

    private static final String TAG = "StatsStaticHelper";
    private static String versionCode = "";

    public static void init(Context context, String appId, String domain) {
        Settings settings = UsageStats.initialize(context, appId);
        String reportUrl = "https://" + domain + "/odborwer_dot/cm";
        settings.reportUrl(reportUrl);
    }

    public static void onEvent(String eventId) {
        onEvent(eventId, new HashMap<>());
    }

    public static void onEvent(String eventId, String label) {
        onEvent(eventId, label, new HashMap<>());
    }

    public static void onEvent(String eventId, String label, Map<String, String> params) {
        try {
            params.put("uuid", InitA.getInstance().getUuid());
            UsageStats.onEvent(eventId, label, params);
        } catch (Exception e) {
            LLog.e(TAG,"onEvent 2 e :" + Log.getStackTraceString(e));
        }
    }

    public static void onEvent(String eventId, Map<String, String> params) {
        try {

            params.put("uuid", InitA.getInstance().getUuid());
            UsageStats.onEvent(eventId, "", params);
        } catch (Exception e) {
            LLog.e(TAG,"onEvent 3 e :" + Log.getStackTraceString(e));
        }
    }

    public static void reportOnEvent(String eventId) {

        onEvent(eventId, new HashMap<>());
    }

    public static void reportOnEvent(String eventId, String label) {
        reportOnEvent(eventId, label, new HashMap<>());
    }

    public static void reportOnEvent(String eventId, String label, Map<String, String> params) {

        try {
            params.put("uuid", InitA.getInstance().getUuid());
            UsageStats.onEvent(eventId, label, params);
        } catch (Exception e) {
            LLog.e(TAG,"onEvent 2 e :" + Log.getStackTraceString(e));
        }
    }

}
