package kr.co.vividnext.sodalive.audio_content.series

import kr.co.vividnext.sodalive.common.SharedPreferenceManager
import kr.co.vividnext.sodalive.settings.ContentType

class SeriesRepository(private val api: SeriesApi) {
    fun getSeriesList(
        creatorId: Long,
        sortType: SeriesListAllViewModel.SeriesSortType,
        page: Int,
        size: Int,
        token: String
    ) = api.getSeriesList(
        creatorId = creatorId,
        sortType = sortType,
        page = page - 1,
        size = size,
        authHeader = token
    )

    fun getSeriesDetail(seriesId: Long, token: String) = api.getSeriesDetail(
        seriesId = seriesId,
        authHeader = token
    )

    fun getSeriesContentList(
        seriesId: Long,
        page: Int,
        size: Int,
        sortType: SeriesListAllViewModel.SeriesSortType,
        token: String
    ) = api.getSeriesContentList(
        seriesId = seriesId,
        page = page - 1,
        size = size,
        sortType = sortType,
        authHeader = token
    )

    fun getRecommendSeriesList(token: String) = api.getRecommendSeriesList(
        isAdultContentVisible = SharedPreferenceManager.isAdultContentVisible,
        contentType = ContentType.values()[SharedPreferenceManager.contentPreference],
        authHeader = token
    )
}
