package Ġcom . simple mobile tools . calendar . pro . interfaces Ċ Ċ import Ġandroidx . room . Dao Ċ import Ġandroidx . room . Insert Ċ import Ġandroidx . room . On Conflict Strategy Ċ import Ġandroidx . room . Query Ċ import Ġcom . simple mobile tools . calendar . pro . helpers . REG ULAR _ EVENT _ TYPE _ ID Ċ import Ġcom . simple mobile tools . calendar . pro . helpers . SOURCE _ CONTACT _ AN NI VER S ARY Ċ import Ġcom . simple mobile tools . calendar . pro . helpers . SOURCE _ CONTACT _ B IR TH DAY Ċ import Ġcom . simple mobile tools . calendar . pro . models . Event Ċ Ċ @ Dao Ċ interface ĠEvents Dao Ġ{ ĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ") ĊĠĠĠ Ġfun ĠgetAll Events (): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun ĠgetAll Events With Types ( eventType Ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġid Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġget Event With Id ( id : ĠLong ): ĠEvent ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġimport _ id Ġ= Ġ: import Id ") ĊĠĠĠ Ġfun Ġget Event With Import Id ( import Id : ĠString ): ĠEvent ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġend _ ts Ġ>= Ġ: from TS ĠAND Ġrepeat _ interval Ġ= Ġ 0 ") ĊĠĠĠ Ġfun Ġget One Time Events From To ( to TS : ĠLong , Ġfrom TS : ĠLong ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġid Ġ= Ġ: id ĠAND Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġend _ ts Ġ>= Ġ: from TS ĠAND Ġrepeat _ interval Ġ= Ġ 0 ") ĊĠĠĠ Ġfun Ġget One Time Event From To With Id ( id : ĠLong , Ġto TS : ĠLong , Ġfrom TS : ĠLong ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġend _ ts Ġ>= Ġ: from TS ĠAND Ġstart _ ts Ġ!= Ġ 0 ĠAND Ġrepeat _ interval Ġ= Ġ 0 ĠAND Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun Ġget One Time Events From To With Types ( to TS : ĠLong , Ġfrom TS : ĠLong , ĠeventType Ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġend _ ts Ġ> Ġ: to TS ĠAND Ġrepeat _ interval Ġ= Ġ 0 ĠAND Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun Ġget One Time Future Events With Types ( to TS : ĠLong , ĠeventType Ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġrepeat _ interval Ġ!= Ġ 0 ") ĊĠĠĠ Ġfun Ġget Repeat able Events From To With Types ( to TS : ĠLong ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġid Ġ= Ġ: id ĠAND Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġrepeat _ interval Ġ!= Ġ 0 ") ĊĠĠĠ Ġfun Ġget Repeat able Event From To With Id ( id : ĠLong , Ġto TS : ĠLong ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġstart _ ts Ġ<= Ġ: to TS ĠAND Ġstart _ ts Ġ!= Ġ 0 ĠAND Ġrepeat _ interval Ġ!= Ġ 0 ĠAND Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun Ġget Repeat able Events From To With Types ( to TS : ĠLong , ĠeventType Ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġrepeat _ interval Ġ!= Ġ 0 ĠAND Ġ( repeat _ limit Ġ== Ġ 0 ĠOR Ġrepeat _ limit Ġ> Ġ: curr TS ) ĠAND Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun Ġget Repeat able Future Events With Types ( curr TS : ĠLong , ĠeventType Ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġid ĠIN Ġ(: ids ) ĠAND Ġimport _ id Ġ!= Ġ\" \" ") ĊĠĠĠ Ġfun Ġget Events ById sWith Import Ids ( ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġtitle ĠLIKE Ġ: search Query ĠOR Ġlocation ĠLIKE Ġ: search Query ĠOR Ġdescription ĠLIKE Ġ: search Query ") ĊĠĠĠ Ġfun Ġget Events For Search ( search Query : ĠString ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġsource Ġ= Ġ\' $ SOURCE _ CONTACT _ B IR TH DAY \' ") ĊĠĠĠ Ġfun Ġget Birth days (): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġsource Ġ= Ġ\' $ SOURCE _ CONTACT _ AN NI VER S ARY \' ") ĊĠĠĠ Ġfun Ġget Ann ivers aries (): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġimport _ id Ġ!= Ġ\" \" ") ĊĠĠĠ Ġfun Ġget Events With Import Ids (): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġsource Ġ= Ġ: source ") ĊĠĠĠ Ġfun Ġget Events From Cal D AV Calendar ( source : ĠString ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġid ĠIN Ġ(: ids )") ĊĠĠĠ Ġfun Ġget Events With Ids ( ids : ĠList < Long >): ĠList < Event > ĊĊĠĠĠ Ġ// val Ġselection Ġ= Ġ"$ COL _ REM IND ER _ MIN UTES Ġ!= Ġ- 1 ĠAND Ġ($ COL _ START _ TS Ġ> Ġ? ĠOR Ġ$ COL _ REPEAT _ INTERVAL Ġ!= Ġ 0 ) ĠAND Ġ$ COL _ START _ TS Ġ!= Ġ 0 " ĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġevents ĠWHERE Ġreminder _ 1 _ minutes Ġ!= Ġ- 1 ĠAND Ġ( start _ ts Ġ> Ġ: current TS ĠOR Ġrepeat _ interval Ġ!= Ġ 0 ) ĠAND Ġstart _ ts Ġ!= Ġ 0 ") ĊĠĠĠ Ġfun Ġget Events At Reboot ( current TS : ĠLong ): ĠList < Event > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ") ĊĠĠĠ Ġfun Ġget Event Ids (): ĠList < Long > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġimport _ id Ġ= Ġ: import Id ") ĊĠĠĠ Ġfun Ġget EventId With Import Id ( import Id : ĠString ): ĠLong ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġimport _ id ĠLIKE Ġ: import Id ") ĊĠĠĠ Ġfun Ġget EventId With Last Import Id ( import Id : ĠString ): ĠLong ? ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġevent _ type Ġ= Ġ: event TypeId ") ĊĠĠĠ Ġfun Ġget Event Ids By EventType ( event TypeId : ĠLong ): ĠList < Long > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġevent _ type ĠIN Ġ(: eventType Ids )") ĊĠĠĠ Ġfun Ġget Event Ids By EventType ( eventType Ids : ĠList < Long >): ĠList < Long > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġparent _ id ĠIN Ġ(: parent Ids )") ĊĠĠĠ Ġfun Ġget Event Ids With Parent Ids ( parent Ids : ĠList < Long >): ĠList < Long > ĊĊĠĠĠ Ġ@ Query (" SELECT Ġid ĠFROM Ġevents ĠWHERE Ġsource Ġ= Ġ: source ĠAND Ġimport _ id Ġ!= Ġ\" \" ") ĊĠĠĠ Ġfun Ġget Cal D AV Calendar Events ( source : ĠString ): ĠList < Long > ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġevents ĠSET Ġevent _ type Ġ= Ġ$ REG ULAR _ EVENT _ TYPE _ ID ĠWHERE Ġevent _ type Ġ= Ġ: event TypeId ") ĊĠĠĠ Ġfun Ġreset Events WithType ( event TypeId : ĠLong ) ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġevents ĠSET Ġimport _ id Ġ= Ġ: import Id , Ġsource Ġ= Ġ: source ĠWHERE Ġid Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġupdate Event Import Id And Source ( import Id : ĠString , Ġsource : ĠString , Ġid : ĠLong ) ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġevents ĠSET Ġrepeat _ limit Ġ= Ġ: repeat Limit ĠWHERE Ġid Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġupdate Event Re petition Limit ( repeat Limit : ĠLong , Ġid : ĠLong ) ĊĊĠĠĠ Ġ@ Query (" UPDATE Ġevents ĠSET Ġrepet ition _ exceptions Ġ= Ġ: re petition Exceptions ĠWHERE Ġid Ġ= Ġ: id ") ĊĠĠĠ Ġfun Ġupdate Event Re petition Exceptions ( re petition Exceptions : ĠString , Ġid : ĠLong ) ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert OrUpdate ( event : ĠEvent ): ĠLong ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġevents ĠWHERE Ġid ĠIN Ġ(: ids )") ĊĠĠĠ Ġfun Ġdelete Events ( ids : ĠList < Long >) Ċ } Ċ