package de.beyondsoft.ownchat.di;

import com.bumptech.glide.Glide;
import de.beyondsoft.ownchat.BewoplanerApplication;
import de.beyondsoft.ownchat.di.scopes.ApplicationScope;
import de.beyondsoft.ownchat.utils.SystemUtils;

import android.app.NotificationManager;
import android.content.Context;
import android.net.ConnectivityManager;

import dagger.Module;
import dagger.Provides;

/**
 * Created by imarneanu on 2/9/17.
 */
@Module
public class ApplicationModule {
    private final Context mAppContext;

    public ApplicationModule(Context appContext) {
        mAppContext = appContext.getApplicationContext();
    }

    @Provides
    @ApplicationScope
    Context provideContext() {
        return mAppContext;
    }

    @Provides
    @ApplicationScope
    BewoplanerApplication providesBewoplanerApplication() {
        return (BewoplanerApplication) mAppContext;
    }

    @Provides
    @ApplicationScope
    SystemUtils provideSystemUtils(ConnectivityManager connectivityManager) {
        return new SystemUtils(connectivityManager);
    }

    @Provides
    @ApplicationScope
    ConnectivityManager provideConnectivityManager() {
        return (ConnectivityManager) mAppContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    @Provides
    @ApplicationScope
    NotificationManager provideNotificationManager() {
        return (NotificationManager) mAppContext.getSystemService(Context.NOTIFICATION_SERVICE);
    }

    @Provides
    @ApplicationScope
    Glide provideGlide() {
        return Glide.get(mAppContext);
    }
}
