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
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf

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


    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, adRootView: View) {

    }

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

    }

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

    }

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

    }

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

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