package com.gh.gamecenter.home.custom.eventlistener

import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.feature.entity.CustomPageTrackData
import com.gh.gamecenter.feature.entity.GameEntity
import com.gh.gamecenter.feature.exposure.ExposureEvent
import com.gh.gamecenter.home.custom.CustomPageViewModel
import com.gh.gamecenter.home.custom.tracker.CommonContentCollectionTracker

class CommonContentCollectionEventHelper(
    viewModel: CustomPageViewModel
) : CustomPageItemChildEventHelper(viewModel) {

    private val tracker = CommonContentCollectionTracker(viewModel.pageLocation)

    fun navigateToLinkPage(link: LinkEntity, text: String, exposureEvent: ExposureEvent?) {
        tracker.trackLinkContentCollectionClick(_item, link, text)
        viewModel.navigateToLinkPage(_item, link, text, exposureEvent)
    }

    fun navigateToGameDetailPage(position: Int, game: GameEntity, text: String, link: LinkEntity?) {
        tracker.trackLinkContentCollectionClick(_item, link, text, game)
        viewModel.navigateToGameDetailPageByGame(_item, position, game, text)
    }

    fun navigateToCommonCollectionDetailPage(link: LinkEntity) {
        tracker.trackLinkContentCollectionClick(_item, link, "全部")
        viewModel.navigateToCommonCollectionDetailPage(_item, link)
    }
}