MΓ³dulo 03 Β· Kotlin for Real Apps: Serialization & Coroutines β LecciΓ³n 3 de 4 Β· ~8 min
Building Models.kt
One data class per JSON shape
data/Models.kt is the whole API contract, translated into Kotlin: one data class for every JSON shape in docs/API-CONTRACT.md. It also gives some of them a computed property, the same trick from Module 02 β logic derived from stored fields, at zero storage cost.
PawWalk's Android app keeps status as a plain String (not an enum) so an unexpected backend value never crashes decoding β but the contract still treats it as a closed set, and Booking exposes a computed Boolean so the rest of the app never has to compare strings by hand.