package com.p3.bewoplaner.di;

import com.bumptech.glide.Glide;
import com.p3.bewoplaner.BewoplanerApplication;
import com.p3.bewoplaner.di.scopes.ApplicationScope;
import com.p3.bewoplaner.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);
    }
}
