package Ġco . mar cell ino . mov iec atalog ue . data . source . local Ċ Ċ import Ġandroidx . paging . DataSource Ċ import Ġco . mar cell ino . mov iec atalog ue . data . Movie Ċ import Ġco . mar cell ino . mov iec atalog ue . data . Show Ċ import Ġco . mar cell ino . mov iec atalog ue . data . source . local . room . Catalog ue Dao Ċ Ċ class ĠLocal DataSource Ġprivate Ġconstructor ( private Ġval Ġcatalog ue Dao : ĠCatalog ue Dao ) Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġvar ĠINSTANCE : ĠLocal DataSource ? Ġ= Ġnull ĊĊĠĠĠĠĠĠĠ Ġfun ĠgetInstance ( catalog ue Dao : ĠCatalog ue Dao ): ĠLocal DataSource Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠINSTANCE Ġ?: ĠLocal DataSource ( catalog ue Dao ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Movies (): ĠDataSource . Factory < Int , ĠMovie > Ġ= Ġcatalog ue Dao . get Movies () ĊĊĠĠĠ Ġfun Ġget Favorite Movies (): ĠDataSource . Factory < Int , ĠMovie > Ġ= Ġcatalog ue Dao . get Favorite Movies () ĊĊĠĠĠ Ġfun Ġget Shows (): ĠDataSource . Factory < Int , ĠShow > Ġ= Ġcatalog ue Dao . get Shows () ĊĊĠĠĠ Ġfun Ġget Favorite Shows (): ĠDataSource . Factory < Int , ĠShow > Ġ= Ġcatalog ue Dao . get Favorite Shows () ĊĊĠĠĠ Ġfun Ġinsert Movies ( movies : ĠList < Movie >) Ġ= Ġcatalog ue Dao . insert Movies ( movies ) ĊĊĠĠĠ Ġfun Ġinsert Shows ( shows : ĠList < Show >) Ġ= Ġcatalog ue Dao . insert Shows ( shows ) ĊĊĠĠĠ Ġfun Ġdelete Movie ( movie : ĠMovie ) Ġ= Ġcatalog ue Dao . delete Movie ( movie ) ĊĊĠĠĠ Ġfun Ġdelete Show ( show : ĠShow ) Ġ= Ġcatalog ue Dao . delete Show ( show ) ĊĊĠĠĠ Ġfun Ġset Movie Favorite ( movie : ĠMovie , Ġis Favorite : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġmovie . is Favorite Ġ= Ġis Favorite ĊĠĠĠĠĠĠĠ Ġcatalog ue Dao . update Movie ( movie ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠsetShow Favorite ( show : ĠShow , Ġis Favorite : ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġshow . is Favorite Ġ= Ġis Favorite ĊĠĠĠĠĠĠĠ Ġcatalog ue Dao . update Show ( show ) ĊĠĠĠ Ġ} Ċ }