package com.composition.android.lib.ad.impl

import com.composition.android.lib.ad.bean.AdUnitBean
import com.composition.android.lib.ad.bean.OnAdShow
import com.composition.android.lib.ad.bean.OnAdShowFail
import com.composition.android.lib.ad.bean.OnNormal
import com.composition.android.lib.ad.interfaces.AdListener

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/9/5
 * description: 广告监听类默认实现
 */
open class NormalAdListener : AdListener {

    private var onAdShow: OnAdShow? = null
    private var onAdClose : OnNormal? = null
    private var onAdClick : OnNormal? = null
    private var onAdLoaded : OnNormal? = null
    private var onAdRewarded : OnNormal? = null
    private var onAdLoadFail : OnNormal? = null
    private var onAdDisLike : OnNormal? = null
    private var onAdSkip: OnNormal? = null
    private var onAdTimeOver : OnNormal? = null
    private var onAdShowFail : OnAdShowFail? = null

    override fun onAdShow(adUnitBean: AdUnitBean) {
        onAdShow?.invoke(adUnitBean)
    }

    override fun onAdClose() {
        onAdClose?.invoke()
    }

    override fun onAdClick() {
        onAdClick?.invoke()
    }

    override fun onAdLoaded() {
        onAdLoaded?.invoke()
    }

    override fun onAdRewarded() {
        onAdRewarded?.invoke()
    }

    override fun onAdLoadedFail() {
        onAdLoadFail?.invoke()
    }

    override fun onAdDisLike() {
        onAdDisLike?.invoke()
    }

    override fun onAdSkip() {
        onAdSkip?.invoke()
    }

    override fun onTimeOver() {
        onAdTimeOver?.invoke()
    }

    override fun onAdShowFail(msg: String) {
        onAdShowFail?.invoke(msg)
    }

    fun onAdShow(onAdShow: OnAdShow){
        this.onAdShow = onAdShow
    }

    fun onAdClose(adClose : OnNormal){
        this.onAdClose = adClose
    }

    fun onAdClick(onAdClick : OnNormal){
        this.onAdClick = onAdClick
    }

    fun onAdLoaded(onAdLoaded : OnNormal){
        this.onAdLoaded = onAdLoaded
    }

    fun onAdRewarded(onAdRewarded : OnNormal){
        this.onAdRewarded = onAdRewarded
    }

    fun onAdLoadedFail(onAdLoadedFail : OnNormal){
        this.onAdLoadFail = onAdLoadedFail
    }

    fun onAdDisLike(onAdDisLike : OnNormal){
        this.onAdDisLike = onAdDisLike
    }

    fun onAdSkip(onAdSkip : OnNormal){
        this.onAdSkip = onAdSkip
    }

    fun onTimeOver(onTimeOver : OnNormal){
        this.onAdTimeOver = onTimeOver
    }

    fun onAdShowFail(onAdShowFail: OnAdShowFail){
        this.onAdShowFail = onAdShowFail
    }

}