package com.base.pdfviewerscannerwhite.ads

import com.base.pdfviewerscannerwhite.helper.EventUtils
import com.base.pdfviewerscannerwhite.helper.MyApplication
import com.google.android.gms.ads.MobileAds
import java.util.concurrent.atomic.AtomicBoolean

object AdmobHelper {

    //开屏限制
    const val open_limit_request = "open_limit_request"
    const val open_limit_show = "open_limit_show"
    const val open_limit_click = "open_limit_click"

    //插页限制
    const val inter_limit_request = "inter_limit_request"
    const val inter_limit_show = "inter_limit_show"
    const val inter_limit_click = "inter_limit_click"

    //原生广告限制
    const val native_limit_request = "native_limit_request"
    const val native_limit_show = "native_limit_show"
    const val native_limit_click = "native_limit_click"

    //推送总数量现在
    val popup_count = "popup_count"//所有常规推送的当日推送次数限制，0 为不限制

    //推送总开关 0 关 1开
    val popup_status = "popup_status"

    //推送样式一配置
    val popup_style1_start = "popup_style1_start"
    val popup_style1_end = "popup_style1_end"
    val popup_style1_status = "popup_style1_status"
    val popup_style1_count = "popup_style1_count"
    val popup_style1_interval = "popup_style1_interval"

    //推送样式二配置
    val popup_style2_start = "popup_style2_start"
    val popup_style2_end = "popup_style2_end"
    val popup_style2_status = "popup_style2_status"
    val popup_style2_count = "popup_style2_count"
    val popup_style2_interval = "popup_style2_interval"

    //推送样式三配置
    val popup_style3_start = "popup_style3_start"
    val popup_style3_end = "popup_style3_end"
    val popup_style3_status = "popup_style3_status"
    val popup_style3_count = "popup_style3_count"
    val popup_style3_interval = "popup_style3_interval"


    //是否展示多语言
    val showLanPage = "showLanPage"

    //开屏加载ad时间
    val open_ad_loading = "open_loading"

    //创建pdf加载ad时间
    val create_pdf_loading = "create_pdf_loading"

    //删除文件
    val delete_loading = "delete_loading"

    //打开文件
    val open_file_loading = "open_file_loading"

    //合并pdf
    val merge_loading = "merge_loading"

    //拆分pdf
    val split_loading = "split_loading"

    //可请求时间段（由 x 定义)
    const val ad_request_period = "ad_request_interval"

    //可请求时间段内允许的最大请求数（由 y 定义)
    const val ad_period_max_request = "ad_period_max_request"

    //可请求时间段间隔时间
    const val ad_request_period_interval = "ad_request_period_interval"

    //展示广告关闭时赋值
    var lastShowedOnHiddenTime = 0L


    var isAdInit = AtomicBoolean(false)
    fun initAdmobAd() {
        MobileAds.initialize(MyApplication.context) { initializationStatus ->
            isAdInit.set(true)
            EventUtils.event("AdmobInit", "AdmobInit")
        }
    }
}