import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import { AuthGuard } from './auth-guard.service';
import { AuthService } from './services/auth/auth.service';
import { CultureService } from './services/culture/culture-service';
import { DashboardService } from './services/dashboard/dashboard.service';
import { DatasetProfileService } from './services/dataset-profile/dataset-profile.service';
import { DatasetWizardService } from './services/dataset-wizard/dataset-wizard.service';
import { DatasetExternalAutocompleteService } from './services/dataset/dataset-external-autocomplete.service';
import { DatasetService } from './services/dataset/dataset.service';
import { DmpInvitationService } from './services/dmp/dmp-invitation.service';
import { DmpProfileService } from './services/dmp/dmp-profile.service';
import { DmpService } from './services/dmp/dmp.service';
import { ExternalDataRepositoryService } from './services/external-sources/data-repository/extternal-data-repository.service';
import { ExternalDatasetService } from './services/external-sources/dataset/external-dataset.service';
import { ExternalSourcesConfigurationService } from './services/external-sources/external-sources-configuration.service';
import { ExternalSourcesService } from './services/external-sources/external-sources.service';
import { ExternalRegistryService } from './services/external-sources/registry/external-registry.service';
import { ExternalResearcherService } from './services/external-sources/researcher/external-researcher.service';
import { ExternalServiceService } from './services/external-sources/service/external-service.service';
import { BaseHttpService } from './services/http/base-http.service';
import { LoggingService } from './services/logging/logging-service';
import { UiNotificationService } from './services/notification/ui-notification-service';
import { ProgressIndicationService } from './services/progress-indication/progress-indication-service';
import { GrantFileUploadService } from './services/grant/grant-file-upload.service';
import { GrantService } from './services/grant/grant.service';
import { ProjectService } from './services/project/project.service';
import { SearchBarService } from './services/search-bar/search-bar.service';
import { TimezoneService } from './services/timezone/timezone-service';
import { UserService } from './services/user/user.service';
import { CollectionUtils } from './services/utilities/collection-utils.service';
import { TypeUtils } from './services/utilities/type-utils.service';
import { QuickWizardService } from './services/quick-wizard/quick-wizard.service';
import { OrganisationService } from './services/organisation/organisation.service';
import { EmailConfirmationService } from './services/email-confirmation/email-confirmation.service';
import { FunderService } from './services/funder/funder.service';
import { ContactSupportService } from './services/contact-support/contact-support.service';
import { LanguageService } from './services/language/language.service';
//
//
// This is shared module that provides all the services. Its imported only once on the AppModule.
//
//

@NgModule({
})
export class CoreServiceModule {
	constructor(@Optional() @SkipSelf() parentModule: CoreServiceModule) {
		if (parentModule) {
			throw new Error(
				'CoreModule is already loaded. Import it in the AppModule only');
		}
	}
	static forRoot(): ModuleWithProviders {
		return {
			ngModule: CoreServiceModule,
			providers: [
				AuthService,
				CookieService,
				BaseHttpService,
				AuthGuard,
				CultureService,
				TimezoneService,
				TypeUtils,
				CollectionUtils,
				UiNotificationService,
				ProgressIndicationService,
				LoggingService,
				SearchBarService,
				DashboardService,
				GrantService,
				ProjectService,
				FunderService,
				GrantFileUploadService,
				DmpService,
				DmpProfileService,
				ExternalSourcesService,
				ExternalSourcesConfigurationService,
				DatasetService,
				DatasetWizardService,
				ExternalDatasetService,
				ExternalDataRepositoryService,
				ExternalRegistryService,
				ExternalResearcherService,
				ExternalServiceService,
				DatasetProfileService,
				UserService,
				DmpInvitationService,
				DatasetExternalAutocompleteService,
				QuickWizardService,
				OrganisationService,
				EmailConfirmationService,
				ContactSupportService,
				LanguageService
			],
		};
	}
}
