use entertainarr_domain::podcast::prelude::PodcastService;
use entertainarr_domain::task::entity::TaskParams;
use entertainarr_domain::tvshow::entity::TvShowTask;
use entertainarr_domain::tvshow::prelude::TvShowService;

impl<MS, PS, TS, TSS> crate::Runner<MS, PS, TS, TSS>
where
    PS: PodcastService,
    TSS: TvShowService,
{
    pub(crate) async fn handle_tvshow(
        &self,
        task: TvShowTask,
        params: &TaskParams,
    ) -> anyhow::Result<()> {
        match task {
            TvShowTask::SynchronizeAll => self.tvshow_service.synchronize_all(params.user_id).await,
            TvShowTask::Synchronize { tvshow_id } => {
                self.tvshow_service
                    .synchronize(params.user_id, tvshow_id)
                    .await
            }
            TvShowTask::SynchronizeLocated {
                tvshow_id,
                language,
            } => {
                self.tvshow_service
                    .synchronize_located(params.user_id, tvshow_id, language)
                    .await
            }
            TvShowTask::SynchronizeSeasonLocated(season_params) => {
                self.tvshow_service
                    .synchronize_season_located(params.user_id, season_params)
                    .await
            }
        }
    }
}
