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

import android.app.Activity
import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.composition.android.lib.ad.basic.*
import com.composition.android.lib.ad.bean.AdUnitBean
import com.composition.android.lib.ad.interfaces.AdListener
import com.composition.android.lib.ad.interfaces.AdLoader

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/9/5
 * description: 位置的广告商加载器接口默认实现， 配置的Advertisers 填错了
 */
class UnknownAdLoader : AdLoader {

    override val advertisers: Advertisers
        get() = Advertisers.UNKNOWN

    override suspend fun load(context: Context, adUnitBean: AdUnitBean): AdResult {
        return AdResult.Fail(adUnitBean, AdLoadCode.FAIL, "未知的广告商，请检查Advertisers,当前:${adUnitBean.advertisersName}")
    }

    override fun getBannerView(context: Context, adResult: AdResult.Success, viewHolder: BannerAdViewHolder): BasicAdView<*>? {
        return null
    }

    override fun getNativeAdView(context: Context, adResult: AdResult.Success, viewHolder: NativeAdViewHolder): View? {
        return null
    }

    override fun populateNativeAdView(context: Context, adResult: AdResult.Success, viewHolder: NativeAdViewHolder, advertisersContainerView: ViewGroup) {

    }

    override fun showInterstitialAd(activity: Activity, adResult: AdResult.Success, adListener: AdListener) {
        adListener.onAdShowFail("未知的广告加载器")

    }

    override fun showRewardedAd(activity: Activity, adResult: AdResult.Success, adListener: AdListener) {
        adListener.onAdShowFail("未知的广告加载器")

    }

    override fun showSplashAd(activity: Activity, splashViewGroup: ViewGroup?, adResult: AdResult.Success, adListener: AdListener) {
        adListener.onAdShowFail("未知的广告加载器")

    }

    override fun showFullScreenAd(activity: Activity, adResult: AdResult.Success, adListener: AdListener) {
        adListener.onAdShowFail("未知的广告加载器")
    }

    override fun showRewardedInterstitialAd(activity: Activity, adResult: AdResult.Success, adListener: AdListener) {
        adListener.onAdShowFail("未知的广告加载器")
    }

    override fun destroyAd(adResult: AdResult) {

    }
}