Skip to content

Instantly share code, notes, and snippets.

@MkhytarMkhoian
Created April 18, 2024 13:28
Show Gist options
  • Save MkhytarMkhoian/335411c7bea721cfe0509541f77bd02a to your computer and use it in GitHub Desktop.
Save MkhytarMkhoian/335411c7bea721cfe0509541f77bd02a to your computer and use it in GitHub Desktop.
@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