package cn.muchinfo.rma.netManage.work

import cn.muchinfo.rma.netManage.base.BaseModel
import cn.muchinfo.rma.netManage.data.BannerBean
import cn.muchinfo.rma.netManage.work.manage.ApiManage
import cn.muchinfo.rma.view.base.app.BaseResult
/**
 *   @auther : lbl
 *   time   : 2021/1/02
 */
class ApiRepository private constructor(
    private val apiManage: ApiManage
) : BaseModel() {

    suspend fun getBannerList(): List<BannerBean> {
        return cacheNetCall {
            apiManage.getBannerData()
        }
    }

    suspend fun getBannerList1(): BaseResult<List<BannerBean>> {
        return apiManage.getBannerData()
    }

    suspend fun getBanner(): BaseResult<List<BannerBean>> {
        return apiManage.getBannerData()
    }

    companion object {

        @Volatile
        private var INSTANCE: ApiRepository? = null

        fun getInstance(apiManage: ApiManage) =
            INSTANCE ?: synchronized(this) {
                INSTANCE ?: ApiRepository(apiManage).also { INSTANCE = it }
            }
    }

}