package com.gh.gamecenter.feature.entity

import android.os.Parcelable
import com.gh.gamecenter.common.utils.SensorsBridge
import kotlinx.parcelize.Parcelize

@Parcelize
data class PageLocation(
    val bottomTab: String = "",
    val bottomTabIndex: Int = -1,
    val pageLevelString: String = "",
    val severalTabPageName: String = "",
    val severalTabPageId: String = "",
    val tabPosition: Int = 0,
    val tabContent: String = "",
    val pageName: String = "",
    val pageId: String = ""
) : Parcelable

@Parcelize
data class CustomPageTrackData(
    val pageLocation: PageLocation,
    val moduleType: String = "",
    val modulePattern: String = "",
    val linkContentName: String = "",
    val linkContentId: String = ""
) : Parcelable {

    fun toKV() =
        arrayOf(
            SensorsBridge.KEY_BOTTOM_TAB, pageLocation.bottomTab,
            SensorsBridge.KEY_MULTI_TAB_NAME, pageLocation.severalTabPageName,
            SensorsBridge.KEY_MULTI_TAB_ID, pageLocation.severalTabPageId,
            SensorsBridge.KEY_POSITION, "${pageLocation.tabPosition}",
            SensorsBridge.KEY_TAB_CONTENT, pageLocation.tabContent,
            SensorsBridge.KEY_CUSTOM_PAGE_NAME, pageLocation.pageName,
            SensorsBridge.KEY_CUSTOM_PAGE_ID, pageLocation.pageId,
            SensorsBridge.KEY_MODULE_TYPE, moduleType,
            SensorsBridge.KEY_MODULE_PATTERN, modulePattern,
            SensorsBridge.KEY_LINK_CONTENT_NAME, linkContentName,
            SensorsBridge.KEY_LINK_CONTENT_ID, linkContentId
        )
}