package com.zaojiao.app.data.remote.di

import com.zaojiao.app.data.remote.api.BabyApi
import com.zaojiao.app.data.remote.api.LoginApi
import com.zaojiao.app.data.remote.api.StudyPlanApi
import com.zaojiao.app.data.remote.api.UserApi
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.create
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class ApiModule {

    @Singleton
    @Provides
    fun provideUserApi(
        retrofit: Retrofit
    ): UserApi {
        return retrofit.create(UserApi::class.java)
    }

    @Singleton
    @Provides
    fun provideBabyApi(
        retrofit: Retrofit
    ): BabyApi {
        return retrofit.create(BabyApi::class.java)
    }

    @Singleton
    @Provides
    fun provideLoginApi(
        retrofit: Retrofit
    ): LoginApi {
        return retrofit.create(LoginApi::class.java)
    }

    @Singleton
    @Provides
    fun provideStudyPlanApi(
        retrofit: Retrofit
    ): StudyPlanApi {
        return retrofit.create(StudyPlanApi::class.java)
    }
}