package ru.myitschool.work.api

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import ru.myitschool.work.api.list.ApiServiceList
import ru.myitschool.work.api.login.ApiServiceLogin
import ru.myitschool.work.api.main.ApiServiceMain
import ru.myitschool.work.api.scan.ApiServiceScan
import javax.inject.Singleton

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

    @Provides
    @Singleton
    fun provideRetrofitClient(@ApplicationContext context: Context): RetrofitClient {
        return RetrofitClient(context)
    }

    @Provides
    @Singleton
    fun provideApiServiceLogin(retrofitClient: RetrofitClient): ApiServiceLogin {
        return retrofitClient.getApiServiceLogin()
    }

    @Provides
    @Singleton
    fun provideApiServiceMain(retrofitClient: RetrofitClient): ApiServiceMain {
        return retrofitClient.getApiServiceMain()
    }

    @Provides
    @Singleton
    fun provideApiServiceScan(retrofitClient: RetrofitClient): ApiServiceScan {
        return retrofitClient.getApiServiceScanAuth()
    }

    @Provides
    @Singleton
    fun provideListApiService(retrofitClient: RetrofitClient): ApiServiceList {
        return retrofitClient.getApiServiceList()
    }
}