package Ġcom . foobar ust . domain . use cases . order Ċ Ċ import Ġcom . foobar ust . domain . common . UseCase Exceptions . ERROR _ USER _ NOT _ SIGNED _ IN Ċ import Ġcom . foobar ust . domain . di . Io Dispatcher Ċ import Ġcom . foobar ust . domain . models . order . Order Rating Ċ import Ġcom . foobar ust . domain . repositories . Auth Repository Ċ import Ġcom . foobar ust . domain . repositories . Order Repository Ċ import Ġcom . foobar ust . domain . states . Resource Ċ import Ġcom . foobar ust . domain . use cases . Flow UseCase Ċ import Ġkotlinx . coroutines . Coroutine Dispatcher Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . flow . flow Ċ import Ġjavax . inject . Inject Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġke vin Ġon Ġ 2 / 2 4 / 2 1 Ċ Ġ*/ Ċ Ċ class ĠSubmit Order Rating UseCase Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġauth Repository : ĠAuth Repository , ĊĠĠĠ Ġprivate Ġval Ġorder Repository : ĠOrder Repository , ĊĠĠĠ Ġ@ Io Dispatcher Ġcoroutine Dispatcher : ĠCor outine Dispatcher Ċ ) Ġ: ĠFlow UseCase < Order Rating , ĠUnit >( coroutine Dispatcher ) Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġexecute ( parameters : ĠOrder Rating ): ĠFlow < Resource < Unit >> Ġ= Ġflow Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġid Token Ġ= Ġif Ġ(! auth Repository . is User Signed In ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠException ( ERROR _ USER _ NOT _ SIGNED _ IN ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġauth Repository . getUserId Token () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġorder Repository . submit Order Rating ( id Token , Ġparameters ) ĊĊĠĠĠĠĠĠĠ Ġemit ( Resource . Success ( Unit )) ĊĠĠĠ Ġ} Ċ }