package Ġcom . al vin h kh . bu set a . search . dao Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . room .* Ċ import Ġandroid . database . Cursor Ċ import Ġcom . al vin h kh . bu set a . search . model . Suggestion ĊĊ Ċ @ Dao Ċ interface ĠSuggest ion Dao Ġ{ ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert ( data : ĠSuggest ion ) ĊĊĠĠĠ Ġ@ Insert ( on Conflict Ġ= ĠOn Conflict Strategy . REPLACE ) ĊĠĠĠ Ġfun Ġinsert ( data : ĠList < Suggestion >) ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ: type ĠAND Ġcompany Ġ= Ġ: company Code ĠAND Ġtext Ġ= Ġ: route No ") ĊĠĠĠ Ġfun Ġdelete ( type : ĠString , Ġcompany Code : ĠString , Ġroute No : ĠString ): ĠInt ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ: type ĠAND Ġcompany Ġ= Ġ: company Code ĠAND Ġdate Ġ< Ġ: last Update ") ĊĠĠĠ Ġfun Ġdelete ( type : ĠString , Ġcompany Code : ĠString , Ġlast Update : ĠLong ): ĠInt ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ: type ĠAND Ġcompany ĠIN Ġ(: company Codes ) ĠAND Ġdate Ġ< Ġ: last Update ") ĊĠĠĠ Ġfun Ġdelete ( type : ĠString , Ġcompany Codes : ĠList < String >, Ġlast Update : ĠLong ): ĠInt ĊĊĠĠĠ Ġ@ Query (" SELECT ĠCOUNT (*) ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' default '") ĊĠĠĠ Ġfun Ġcount Default (): ĠInt ĊĊĠĠĠ Ġ@ Query (" SELECT ĠCOUNT (*) ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' history '") ĊĠĠĠ Ġfun Ġcount History (): ĠInt ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' history '") ĊĠĠĠ Ġfun Ġclear History (): ĠInt ĊĊĠĠĠ Ġ@ Query (" DELETE ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' default '") ĊĠĠĠ Ġfun Ġclear Default () ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' default ' ĠORDER ĠBY Ġcompany ĠDESC , Ġtext ĠASC ") ĊĠĠĠ Ġfun Ġsuggestion LiveData (): ĠLive Data < Mutable List < Suggestion >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ_ id , Ġ* ĠFROM Ġsuggestions ĠWHERE Ġtext ĠLIKE Ġ: text ĠAND Ġtype Ġ= Ġ' default ' ĠORDER ĠBY Ġtext ĠASC , Ġcompany ĠDESC ") ĊĠĠĠ Ġfun Ġdefault Cursor ( text : ĠString ): ĠCursor ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ_ id , Ġ* ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' history ' ĠORDER ĠBY Ġdate ĠDESC ĠLIMIT Ġ: limit ") ĊĠĠĠ Ġfun Ġhistory Cursor ( limit : ĠInt ): ĠCursor ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' history ' ĠORDER ĠBY Ġdate ĠDESC , Ġcompany ĠDESC , Ġtext ĠASC ") ĊĠĠĠ Ġfun Ġhistory LiveData (): ĠLive Data < Mutable List < Suggestion >> ĊĊĠĠĠ Ġ@ Query (" SELECT Ġ* ĠFROM Ġsuggestions ĠWHERE Ġtype Ġ= Ġ' history ' ĠORDER ĠBY Ġdate ĠDESC , Ġcompany ĠDESC , Ġtext ĠASC ĠLIMIT Ġ: limit ") ĊĠĠĠ Ġfun Ġhistory List ( limit : ĠInt ): ĠList < Suggestion > Ċ Ċ }