package com.gh.gamecenter.hud

import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.utils.SensorsBridge
import com.gh.gamecenter.common.utils.asVGame
import com.gh.gamecenter.common.utils.getMetaExtra
import com.lightgame.download.DownloadEntity

object HeadUpDisplayLogHelper {

    fun trackInstallationShow(downloadEntity: DownloadEntity, source: String) {
        SensorsBridge.trackInstallationPromptBarShow(
            source = source,
            downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
            downloadStatus =  downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
            gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
            gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
            gameId = downloadEntity.gameId,
            gameName = downloadEntity.name
        )
    }

    fun trackInstallationClick(downloadEntity: DownloadEntity, source: String) {
        SensorsBridge.trackInstallationPromptBarClick(
            source = source,
            downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
            downloadStatus =  downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
            gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
            gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
            gameId = downloadEntity.gameId,
            gameName = downloadEntity.name
        )
    }

    fun trackDownloadResumeShow(downloadEntity: DownloadEntity) {
        SensorsBridge.trackAutomaticInstallationPromptBarShow(
            downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
            downloadStatus =  downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
            gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
            gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
            gameId = downloadEntity.gameId,
            gameName = downloadEntity.name
        )
    }

    fun trackDownloadResumeClicked(downloadEntity: DownloadEntity) {
        SensorsBridge.trackAutomaticInstallationPromptBarClick(
            downloadType = if (downloadEntity.asVGame()) "畅玩下载" else "本地下载",
            downloadStatus =  downloadEntity.getMetaExtra(Constants.DOWNLOAD_STATUS_IN_CHINESE),
            gameSchemaType = if (downloadEntity.getMetaExtra(Constants.KEY_BIT) == "32") "32位" else "64位",
            gameType = downloadEntity.getMetaExtra(Constants.GAME_CATEGORY_IN_CHINESE),
            gameId = downloadEntity.gameId,
            gameName = downloadEntity.name
        )
    }

}