package hu.bbara.purefin.data.module

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import hu.bbara.purefin.core.Offline
import hu.bbara.purefin.core.Online
import hu.bbara.purefin.core.data.HomeRepository
import hu.bbara.purefin.core.data.LocalMediaRepository
import hu.bbara.purefin.core.data.SearchManager
import hu.bbara.purefin.data.catalog.InMemoryAppContentRepository
import hu.bbara.purefin.data.catalog.InMemoryLocalMediaRepository
import hu.bbara.purefin.data.catalog.OfflineLocalMediaRepository
import hu.bbara.purefin.data.jellyfin.JellyfinMediaMetadataUpdaterImpl
import hu.bbara.purefin.data.jellyfin.SearchManagerImpl
import hu.bbara.purefin.core.data.MediaMetadataUpdater

@Module
@InstallIn(SingletonComponent::class)
abstract class MediaRepositoryModule {

    @Binds
    @Online
    abstract fun bindOnlineRepository(impl: InMemoryLocalMediaRepository): LocalMediaRepository

    @Binds
    @Offline
    abstract fun bindOfflineRepository(impl: OfflineLocalMediaRepository): LocalMediaRepository

    @Binds
    abstract fun bindHomeRepository(impl: InMemoryAppContentRepository): HomeRepository

    @Binds
    abstract fun bindMediaMetadataUpdater(impl: JellyfinMediaMetadataUpdaterImpl): MediaMetadataUpdater

    @Binds
    abstract fun bindSearchManager(impl: SearchManagerImpl): SearchManager
}