package ru.fincode.tsudesk.feature.news.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import ru.fincode.tsudesk.feature.news.data.NewsRepositoryImpl
import ru.fincode.tsudesk.feature.news.data.remote.api.NewsApi
import ru.fincode.tsudesk.feature.news.domain.repository.NewsRepository
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object NewsModule {

    @Provides
    @Singleton
    fun provideNewsApi(retrofit: Retrofit): NewsApi =
        retrofit.create(NewsApi::class.java)

    @Provides
    @Singleton
    fun provideNewsRepository(impl: NewsRepositoryImpl): NewsRepository = impl
}