package Ġio . w ax 9 1 1 . challenge . data . credit . source Ċ Ċ import Ġio . w ax 9 1 1 . challenge . data . core . error . Request Error Ċ import Ġio . w ax 9 1 1 . challenge . data . core . extensions . fetch Ċ import Ġio . w ax 9 1 1 . challenge . data . credit . converter . Credit Converter Ċ import Ġio . w ax 9 1 1 . challenge . data . credit . entity . Credit Entity Ċ import Ġio . w ax 9 1 1 . challenge . data . credit . extensions . isValid Ċ import Ġio . w ax 9 1 1 . challenge . data . credit . source . local . Credit Local Source Ċ import Ġio . w ax 9 1 1 . challenge . data . credit . source . remote . Credit Remote Source Ċ import Ġio . w ax 9 1 1 . challenge . data . settings . IC lient Settings Ċ import Ġretrofit 2 . HttpException Ċ import Ġjava . net . Socket TimeoutException Ċ import Ġkotlin . jvm . Throws Ċ Ċ /** Ċ Ġ* ĠLogin Ġrepository Ġimplementation Ċ Ġ* Ċ Ġ* Ġ@ param Ġlocal Source ĠSource Ġfor Ġaccessing Ġlocal Ġbacked Ġstorage Ċ Ġ* Ġ@ param Ġremote Source ĠSource Ġfor Ġaccessing Ġremote Ġresources Ċ Ġ* Ġ@ param Ġsettings ĠSettings Ġfac ade Ġfor Ġauthentication Ġsettings Ċ Ġ* Ġ@ param Ġconverter ĠMapper Ġfor Ġconverting Ġmodels Ġto Ġentities Ċ Ġ*/ Ċ internal Ġclass ĠCredit DataSource ( ĊĠĠĠ Ġprivate Ġval Ġlocal Source : ĠCredit Local Source , ĊĠĠĠ Ġprivate Ġval Ġremote Source : ĠCredit Remote Source , ĊĠĠĠ Ġprivate Ġval Ġsettings : ĠI Client Settings Ċ ) Ġ{ ĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġget Cached Entity (): ĠCredit Entity ? Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠclientId Ġ= Ġsettings . clientId . value ĊĊĠĠĠĠĠĠĠ Ġreturn ĠclientId ?. let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlocal Source . getC redit For Client ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Throws ( HttpException :: class , ĠRequest Error :: class , ĠSocket TimeoutException :: class ) ĊĠĠĠ Ġsuspend Ġoperator Ġfun Ġinvoke (): ĠCredit Entity Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcached Entity Ġ= Ġget Cached Entity () ĊĠĠĠĠĠĠĠ Ġif Ġ( cached Entity ?. isValid () Ġ== Ġtrue ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġcached Entity ĊĊĠĠĠĠĠĠĠ Ġval Ġmodel Ġ= Ġremote Source . getC redit Score (). fetch () ĊĊĠĠĠĠĠĠĠ Ġsettings . clientId . value Ġ= Ġmodel . credit Report Info . client Ref ĊĊĠĠĠĠĠĠĠ Ġval Ġentity Ġ= ĠCredit Converter . from ( model ) ĊĊĠĠĠĠĠĠĠ Ġlocal Source . upsert ( entity ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġentity ĊĠĠĠ Ġ} Ċ }