diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelSortModels.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelSortModels.kt new file mode 100644 index 00000000..a348e2ef --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/model/CreatorChannelSortModels.kt @@ -0,0 +1,27 @@ +package kr.co.vividnext.sodalive.v2.creator.channel.model + +import androidx.annotation.StringRes +import kr.co.vividnext.sodalive.R +import kr.co.vividnext.sodalive.v2.common.data.ContentSort + +data class CreatorChannelSortOptionUiModel( + val sort: ContentSort, + @param:StringRes val labelResId: Int, + val isSelected: Boolean +) + +@StringRes +fun ContentSort.toLabelResId(): Int = when (this) { + ContentSort.LATEST -> R.string.screen_audio_content_sort_newest + ContentSort.POPULAR -> R.string.screen_audio_content_sort_popularity + ContentSort.OWNED -> R.string.creator_channel_live_sort_owned + ContentSort.PRICE_HIGH -> R.string.screen_audio_content_sort_price_high + ContentSort.PRICE_LOW -> R.string.screen_audio_content_sort_price_low +} + +fun ContentSort.toSortOptionUiModel(selectedSort: ContentSort): CreatorChannelSortOptionUiModel = + CreatorChannelSortOptionUiModel( + sort = this, + labelResId = toLabelResId(), + isSelected = this == selectedSort + )