//
// Created by #Suyghur, on 2021/06/21.
//

#include <params_kit.h>
#include <toolkit.h>
#include "include/comm_map.h"

CommMap::CommMap() = default;

CommMap::~CommMap() = default;

CommMap *CommMap::GetInstance() {
    static CommMap instance;
    return &instance;
}

void CommMap::Init(JNIEnv *env, jobject context) {
    //biz
    comm_params["gcp_code"] = ParamsKit::GetGcpCode(env, context);
    comm_params["game_code"] = ParamsKit::GetGameCode(env, context);
    comm_params["package_name"] = ToolKit::GetPackageName(env, context);

    //vers
    comm_params["server_version"] = ToolKit::GetServerVersion(env);
    comm_params["client_version"] = ToolKit::GetClientVersion(env);
    comm_params["game_version"] = ToolKit::GetVersionName(env, context);

    //device
    if (ToolKit::IsEmulator(env, context)) {
        comm_params["simulator"] = 1;
    } else {
        comm_params["simulator"] = 0;
    }

    comm_params["android_id"] = ToolKit::GetAndroidDeviceId(env, context);
    comm_params["network"] = ToolKit::GetNetworkType(env, context);
    comm_params["os"] = 1;
    comm_params["os_version"] = ToolKit::GetDeviceSoftwareVersion();
    comm_params["mobile_model"] = ToolKit::GetDeviceModel();
    comm_params["mobile_mfrs"] = ToolKit::GetDeviceManufacturer();
    comm_params["mobile_brand"] = ToolKit::GetMobileBrand();
}


