package com.composition.android.lib.ad.factory

import com.composition.android.lib.ad.AdManager
import com.composition.android.lib.ad.impl.UnknownAdLoader
import com.composition.android.lib.ad.bean.AdUnitBean
import com.composition.android.lib.ad.interfaces.AdLoader

/**
 * @classname:
 * @author: LiuXiaoLong
 * @date: 2022/9/5
 * description:
 */
object AdLoaderFactory {


    fun getAdLoader(adUnitBean: AdUnitBean) : AdLoader{
        return try {
            AdManager.instance.adLoaderLists.find {
                it.first == adUnitBean.getAdvertisers()
            }?.second?: UnknownAdLoader()
        }catch (e : Exception){
            UnknownAdLoader()
        }
    }

}