Created
April 18, 2024 13:28
-
-
Save MkhytarMkhoian/335411c7bea721cfe0509541f77bd02a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parcelize | |
data class CategoryModel( | |
val categoryId: Long = ROOT_CATEGORY_ID, | |
val name: String = "", | |
val children: List<CategoryModel> = emptyList(), | |
val image: String? = null, | |
val adsCount: Int? = null, | |
val feedType: FeedType = FeedType.DEFAULT, | |
) : Parcelable { | |
companion object { | |
internal const val ROOT_CATEGORY_ID = 1L | |
} | |
@IgnoredOnParcel | |
val isRoot: Boolean | |
get() = categoryId == ROOT_CATEGORY_ID | |
@IgnoredOnParcel | |
val hasChildren: Boolean | |
get() = children.isNotEmpty() | |
@IgnoredOnParcel | |
val hasAds: Boolean | |
get() = adsCount != null && adsCount > 0 | |
enum class FeedType(val id: String) { | |
MAP("map"), | |
DEFAULT("default") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment