package com.tangem.features.send.api.subcomponents.feeSelector.analytics

import com.tangem.core.analytics.models.AnalyticsEvent
import com.tangem.core.analytics.models.AnalyticsParam
import com.tangem.core.analytics.models.AnalyticsParam.Key.BLOCKCHAIN
import com.tangem.core.analytics.models.AnalyticsParam.Key.FEE_TOKEN
import com.tangem.core.analytics.models.AnalyticsParam.Key.FEE_TYPE
import com.tangem.core.analytics.models.AnalyticsParam.Key.SOURCE
import com.tangem.core.analytics.models.AnalyticsParam.Key.TOKEN_PARAM
import com.tangem.features.send.api.analytics.CommonSendAnalyticEvents

sealed class CommonSendFeeAnalyticEvents(
    category: String,
    event: String,
    params: Map<String, String> = emptyMap(),
) : AnalyticsEvent(category = category, event = event, params = params) {

    abstract val categoryName: String

    /** Selected fee (send after next screen opened) */
    data class SelectedFee(
        override val categoryName: String,
        val feeType: AnalyticsParam.FeeType,
        val source: CommonSendAnalyticEvents.CommonSendSource,
        val feeToken: String,
        val blockchain: String,
    ) : CommonSendFeeAnalyticEvents(
        category = categoryName,
        event = "Fee Selected",
        params = mapOf(
            FEE_TYPE to feeType.value,
            SOURCE to source.analyticsName,
            FEE_TOKEN to feeToken,
            BLOCKCHAIN to blockchain,
        ),
    )

    /** Custom fee selected */
    data class CustomFeeButtonClicked(
        override val categoryName: String,
        val blockchain: String,
        val token: String,
    ) : CommonSendFeeAnalyticEvents(
        category = categoryName,
        event = "Custom Fee Clicked",
        params = mapOf(
            BLOCKCHAIN to blockchain,
            TOKEN_PARAM to token,
        ),
    )

    /** Custom fee edited */
    data class GasPriceInserter(
        override val categoryName: String,
    ) : CommonSendFeeAnalyticEvents(
        category = categoryName,
        event = "Gas Price Inserted",
    )
}