package com.jld.vod.repository

import androidx.paging.Pager
import androidx.paging.PagingConfig
import androidx.paging.PagingData
import com.jld.vod.interfaces.remote.Apis
import com.jld.vod.model.bean.CategoryFatherAllBean
import com.jld.vod.model.bean.FindAboutAllBean
import com.jld.vod.model.bean.MusicByMidBean
import kotlinx.coroutines.flow.Flow

class MusicRepository {

    /**
     * 获取音乐一级列表分类
     */
    fun getCategoryFatherAllByMid(gameApi: Apis, mid:Long,  lid:Long): Flow<PagingData<CategoryFatherAllBean>> {
        return Pager(
            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
            pagingSourceFactory = { CategoryFatherAllPagingSource(gameApi,mid,lid) }
        ).flow
    }

    fun getMusicAllList(gameApi: Apis, mid:Long,  lid:Long): Flow<PagingData<MusicByMidBean>> {
        return Pager(
            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
            pagingSourceFactory = { MusicAllPagingSource(gameApi,mid,lid) }
        ).flow
    }
    fun getMusiCidList(gameApi: Apis, cid:Long,mid:Long,  lid:Long): Flow<PagingData<MusicByMidBean>> {
        return Pager(
            config = PagingConfig(pageSize = 10, initialLoadSize = 20),
            pagingSourceFactory = { MusicPagingSource(gameApi,cid,mid,lid) }
        ).flow
    }
}