package Ġorg . simple . clin ic . summary . tele consult ation . sync Ċ Ċ import Ġandroidx . room . Dao Ċ import Ġandroidx . room . Entity Ċ import Ġandroidx . room . Insert Ċ import Ġandroidx . room . On Conflict Strategy . REPLACE Ċ import Ġandroidx . room . PrimaryKey Ċ import Ġandroidx . room . Query Ċ import Ġorg . simple . clin ic . patient . Sync Status Ċ import Ġjava . time . Instant Ċ import Ġjava . util . UUID Ċ Ċ @ Entity Ċ data Ġclass ĠTele consult ation Facility Info ( ĊĠĠĠ Ġ@ PrimaryKey ĊĠĠĠ Ġval Ġtele consult ation Facility Id : ĠUUID , ĊĊĠĠĠ Ġval Ġfacility Id : ĠUUID , ĊĊĠĠĠ Ġval ĠcreatedAt : ĠInstant , ĊĊĠĠĠ Ġval ĠupdatedAt : ĠInstant , ĊĊĠĠĠ Ġval Ġdeleted At : ĠInstant ?, ĊĊĠĠĠ Ġval Ġsync Status : ĠSync Status Ċ ) Ġ{ ĊĊĠ Ġfun Ġto Payload ( medical Off ic ers : ĠList < Medical Off icer >): ĠTele consult ation Facility Info Payload Ġ{ ĊĠĠĠ Ġreturn ĠTele consult ation Facility Info Payload ( ĊĠĠĠĠĠĠĠ Ġid Ġ= Ġtele consult ation Facility Id , ĊĠĠĠĠĠĠĠ Ġfacility Id Ġ= Ġfacility Id , ĊĠĠĠĠĠĠĠ Ġmedical Off ic ers Ġ= Ġmedical Off ic ers . map Ġ{ Ġit . to Payload () Ġ}, ĊĠĠĠĠĠĠĠ ĠcreatedAt Ġ= ĠcreatedAt , ĊĠĠĠĠĠĠĠ ĠupdatedAt Ġ= ĠupdatedAt , ĊĠĠĠĠĠĠĠ Ġdeleted At Ġ= Ġdeleted At ĊĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Dao ĊĠ Ġinterface ĠRoom Dao Ġ{ ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠREPLACE ) ĊĠĠĠ Ġfun Ġsave ( tele consult ation Facility Info : ĠList < Tele consult ation Facility Info >) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM ĠTele consult ation Facility Info ") ĊĠĠĠ Ġfun Ġclear () ĊĊĠĠĠ Ġ@ Query (" SELECT ĠCOUNT ( tele consult ation Facility Id ) ĠFROM ĠTele consult ation Facility Info ") ĊĠĠĠ Ġfun Ġcount (): ĠInt ĊĊĠĠĠ Ġ@ Query (" SELECT ĠCOUNT ( tele consult ation Facility Id ) ĠFROM ĠTele consult ation Facility Info ĠWHERE Ġsync Status Ġ= Ġ: sync Status ") ĊĠĠĠ Ġfun Ġcount With Status ( sync Status : ĠSync Status ): ĠInt ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠTele consult ation Facility Info ĠWHERE Ġtele consult ation Facility Id Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġget One ( id : ĠUUID ): ĠTele consult ation Facility Info ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġtele consult ation Facility Id ĠFROM ĠTele consult ation Facility Info ĠWHERE Ġsync Status Ġ= Ġ: sync Status ") ĊĠĠĠ Ġfun Ġrecord Ids With Sync Status ( sync Status : ĠSync Status ): ĠList < UUID > ĊĊĠĠĠ Ġ@ Query (" UPDATE ĠTele consult ation Facility Info ĠSET Ġsync Status Ġ= Ġ: new Status ĠWHERE Ġsync Status Ġ= Ġ: old Status ") ĊĠĠĠ Ġfun Ġupdate Sync Status ( old Status : ĠSync Status , Ġnew Status : ĠSync Status ) ĊĊĠĠĠ Ġ@ Query (" UPDATE ĠTele consult ation Facility Info ĠSET Ġsync Status Ġ= Ġ: new Status ĠWHERE Ġtele consult ation Facility Id ĠIN Ġ(: uuid s )") ĊĠĠĠ Ġfun Ġupdate Sync Status For Ids ( uuid s : ĠList < UUID >, Ġnew Status : ĠSync Status ) ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM ĠTele consult ation Facility Info ĠWHERE Ġsync Status Ġ= Ġ: sync Status ") ĊĠĠĠ Ġfun Ġrecord sWith Sync Status ( sync Status : ĠSync Status ): ĠList < Tele consult ation Facility Info > ĊĠ Ġ} Ċ } Ċ