Created
April 18, 2024 13:17
-
-
Save MkhytarMkhoian/5698243d48b5b87e80ae63ee6a6ca495 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@JsonClass(generateAdapter = true) | |
data class CategoryDTO( | |
@Json(name = "id") val id: Long, | |
@Json(name = "image") val image: String? = null, | |
@Json(name = "children") val children: List<CategoryDTO>, | |
@Json(name = "name") val name: String, | |
@Json(name = "ads_count") val adsCount: Int? = null, | |
@Json(name = "feed_type") val feedType: FeedType? = null, | |
) { | |
enum class FeedType(val id: String) : Serializable { | |
@Json(name = "map") | |
MAP("map"), | |
@Json(name = "default") | |
DEFAULT("default"); | |
companion object { | |
fun from(id: String): FeedType? { | |
return when (id) { | |
MAP.id -> MAP | |
DEFAULT.id -> DEFAULT | |
else -> null | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment