package Ġcom . ou day . pokemon . pokemon details Ċ Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . ou day . pokemon . details . data . model . response . Pokemon Details Response Ċ import Ġcom . ou day . pokemon . details . use case . Pokemon Details UseCase Ċ import Ġkotlinx . coroutines . delay Ċ import Ġkotlinx . coroutines . flow . flow Ċ Ċ object ĠFake Pokemon Details UseCase Ġ: ĠPokemon Details UseCase Ġ{ ĊĊĠĠĠ Ġvar Ġuse Case State : ĠUse Case State Ġ= ĠUse Case State . SUCCESS ĊĊĠĠĠ Ġprivate Ġval Ġpokemon Details : ĠPokemon Details Response Ġ= ĊĠĠĠĠĠĠĠ ĠGson (). fromJson ( PO KE MON _ RESPONSE , ĠPokemon Details Response :: class . java ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġfetch Pokemon Details ( pokemon ID : ĠInt ) Ġ= Ġflow Ġ{ ĊĠĠĠĠĠĠĠ Ġdelay ( 5 0 0 ) ĊĠĠĠĠĠĠĠ Ġwhen Ġ( use Case State ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUse Case State . SUCCESS Ġ-> Ġemit ( Result . success ( pokemon Details )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġemit ( Result . failure < Pokemon Details Response >( Exception (" Backend Ġerror "))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġenum Ġclass ĠUse Case State Ġ{ ĠSUCCESS , ĠERROR Ġ} Ċ } Ċ