package com.telephoners.krakyournet.ctf.modules;

import com.google.inject.AbstractModule;
import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration;
import com.telephoners.krakyournet.ctf.providers.DatastoreProvider;
import org.mongodb.morphia.Datastore;

public class ApplicationModule extends AbstractModule
{
    private final ApplicationConfiguration applicationConfiguration;

    public ApplicationModule(ApplicationConfiguration applicationConfiguration)
    {
        this.applicationConfiguration = applicationConfiguration;
    }

    @Override
    protected void configure()
    {
        bind(ApplicationConfiguration.class).toInstance(applicationConfiguration);
        bind(Datastore.class).toInstance(new DatastoreProvider(applicationConfiguration).getDatastore());
    }
}
