package com.base.datarecovery.ads

import AdMaxNativeUtils
import android.app.Activity
import android.view.View
import android.view.ViewGroup
import com.base.datarecovery.R
import com.base.datarecovery.ads.admob.AdmobInterstitialUtils
import com.base.datarecovery.ads.admob.AdmobNativeUtils
import com.base.datarecovery.ads.admob.AdmobOpenUtils
import com.base.datarecovery.ads.max.AdMaxInterstitialUtils
import com.base.datarecovery.ads.max.AdMaxOpenUtils
import com.base.datarecovery.help.ConfigHelper
import com.base.datarecovery.utils.LogEx

object AdmobMaxHelper {
    private val TAG = ""

    fun admobMaxShowInterstitialAd(activity: Activity, onHidden: (() -> Unit)? = null) {
        if (ConfigHelper.admobTrueMaxFlase) {
            AdmobInterstitialUtils.showInterstitialAd(activity) {
                onHidden?.invoke()
            }
        } else {
            AdMaxInterstitialUtils.showInterstitialAd(activity) {
                onHidden?.invoke()
            }
        }
    }

    fun admobMaxShowOpenAd(activity: Activity, onHidden: (() -> Unit)? = null) {
        if (ConfigHelper.admobTrueMaxFlase) {
            AdmobOpenUtils.showAppOpenAd(activity) {
                onHidden?.invoke()
            }
        } else {
            AdMaxOpenUtils.showAppOpenAd(activity) {
                onHidden?.invoke()
            }
        }
    }

    fun admobMaxShowNativeAd(activity: Activity, parent: ViewGroup, where: Int = 0) {
        if (ConfigHelper.admobTrueMaxFlase) {
            AdmobNativeUtils.showNativeAd(activity, parent)
        } else {
            var layout = R.layout.layout_max_native_small
            if (where == 0) {
                layout = R.layout.layout_max_native_small_f8f8f8
            }
            AdMaxNativeUtils.showNativeAd(activity, parent, layout)
        }
    }

}