package Ġcom . pri am bu di 1 9 . mov iest v shows . ui . view model Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . live Data Ċ import Ġcom . pri am bu di 1 9 . mov iest v shows . data . model . movie . Movie Detail Ċ import Ġcom . pri am bu di 1 9 . mov iest v shows . data . repository . Movie Repository Ċ Ċ class ĠDetail Movie ViewModel ( private Ġval Ġrepo : ĠMovie Repository ) Ġ: ĠViewModel () Ġ{ ĊĠĠĠ Ġfun Ġget Detail Movie ( id : ĠInt ) Ġ= Ġlive Data Ġ{ ĊĠĠĠĠĠĠĠ Ġemit Source ( repo . get Detail Movie ( id )) ĊĠĠĠ Ġ} ĊĠĠĠ Ġfun Ġadd Favorite Movie ( movie Detail : ĠMovie Detail ){ ĊĠĠĠĠĠĠĠ Ġrepo . add Favorite Movie ( movie Detail ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcheck Favorite Movie ( id : ĠInt ) Ġ= Ġlive Data Ġ{ ĊĠĠĠĠĠĠ Ġemit Source ( repo . check Favorite Movie ( id )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete Favorite Movie ( movie : ĠMovie Detail ){ ĊĠĠĠĠĠĠĠ Ġrepo . delete Favorite Movie ( movie ) ĊĠĠĠ Ġ} Ċ } Ċ